Home arrow Style Sheets arrow Page 3 - CSS: Crossing the Border
STYLE SHEETS

CSS: Crossing the Border


In our previous tutorials we discussed working with text and fonts in your cascading style sheets. Here, we will discuss working with the various border properties. There are a lot of ways to manipulate them, so let's dive right in.

Author Info:
By: James Payne
Rating: 4 stars4 stars4 stars4 stars4 stars / 5
March 24, 2008
TABLE OF CONTENTS:
  1. · CSS: Crossing the Border
  2. · Setting Different Borders Around An Element
  3. · How to Set the Border Width
  4. · How to Set Border Colors

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
CSS: Crossing the Border - How to Set the Border Width
(Page 3 of 4 )

You can also adjust the width of your borders. It works in much the same way as the style, with the order going: top, right, bottom, left.


<html>

<head>

<style type="text/css">

p.one

{

border-style: solid;

border-width: 5px;

text-align: center

}

p.two

{

border-style: solid;

border-width: thick

}

p.three

{

border-style: solid;

border-width: 5px 10px

}

p.four

{

border-style: solid;

border-width: 5px 10px 1px

}

p.five

{

border-style: solid;

border-width: 5px 10px 1px medium;

text-align: center

}

</style>

</head>

<body>

<p class="one">Round One!</p>

<p class="two">Chuck Norris looks at Bruce Lee...</p>

<p class="three">Bruce Lee looks at Chuck Norris</p>

<p class="four">Chuck Norris dies.</p>

<p class="five">Bruce Lee is the winner!</p>

<p align=center><b>Up next...Michael Jackson versus Adult Macaulay Culkin!</b></p>

</body>

</html>

How to Set the Individual Border Widths

The Top:


<html>

<head>

<style type="text/css">

p.example

{

border-style: solid;

border-top-width: 20px

}

p.secondexample

{

border-style: dotted;

border-top-width: thin

}

p.thirdexample

{

border-style: dotted;

border-top-width: 20px

</style>

</head>

<body>

<p class="example">Harry Potter contracted Hogwarts from Hermione</p>

<p class="secondexample">Of course Hermione got them from Ron Weasley</p>

<p class="thirdexample">And Ron Weasley got them from the toilet in Slitherin house.</P>

</body>

</html>

The Bottom


<html>

<head>

<style type="text/css">

p.example

{

border-style: solid;

border-bottom-width: 20px

}

p.secondexample

{

border-style: dotted;

border-bottom-width: thin

}

p.thirdexample

{

border-style: dotted;

border-bottom-width: 20px

</style>

</head>

<body>

<p class="example">Harry Potter contracted Hogwarts from Hermione</p>

<p class="secondexample">Of course Hermione got them from Ron Weasley</p>

<p class="thirdexample">And Ron Weasley got them from the toilet in Slitherin house.</P>

</body>

</html>

The Left


<html>

<head>

<style type="text/css">

p.example

{

border-style: solid;

border-left-width: 20px

}

p.secondexample

{

border-style: dotted;

border-left-width: thin

}

p.thirdexample

{

border-style: dotted;

border-left-width: 20px

</style>

</head>

<body>

<p class="example">Harry Potter contracted Hogwarts from Hermione</p>

<p class="secondexample">Of course Hermione got them from Ron Weasley</p>

<p class="thirdexample">And Ron Weasley got them from the toilet in Slitherin house.</P>

</body>

</html>

The Right


<html>

<head>

<style type="text/css">

p.example

{

border-style: solid;

border-right-width: 20px

}

p.secondexample

{

border-style: dotted;

border-right-width: thin

}

p.thirdexample

{

border-style: dotted;

border-right-width: 20px

</style>

</head>

<body>

<p class="example">Harry Potter contracted Hogwarts from Hermione</p>

<p class="secondexample">Of course Hermione got them from Ron Weasley</p>

<p class="thirdexample">And Ron Weasley got them from the toilet in Slitherin house.</P>

</body>

</html>


blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...
- CSS3 Animated Image Gallery: Transitions
- CSS3 Properties: Fixed Heights with box-sizi...
- CSS3 Properties: Altering Strokes and 3D Eff...
- CSS3 Properties: Text-Stroke
- CSS3 Transitions: Width and Height Properties
- Creating a Drop Down Menu in CSS3
- Intro to CSS Transitions

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials