<body onload="MM_preloadImages('http://tutorials.elusionerie.com/wp-content/themes/Galaxy/switch2.png');new Accordian('basic-accordian',5,'header_highlight');">

Search the site

Subscribe

Subscribe to the blog!!!

Get updates on all the happenings @ this place. If you want to see something on here, please feel free to suggest anything!

Browse...

iiNet SUED for allowing illegal file sharing!?!?! Its the end of the internet as we know it... 8 hrs ago
Change font size

Horizontal Rules

Tags: ,

Horizontal rules can act as dividers of a page - they are useful for breaking long paragraphs and huge chunks of text.

The horizontal rule tag is defined with <hr> :


This usually displays as a default grey and ugly line (but I’ve formatted the horizontal rule in this layout’s CSS). Horizontal rules by default fill up the container it is in but you can customize the horizontal rule with CSS and alter its width and height as well.

The CSS

For a really simple horizontal bar, you could use the following:


hr {
width: 200px;
height: 3px;
border: 1px solid #959595;
background-color: #fefccc;
margin:0 auto;
}

This will obviously change all your <hr> tags to look like a solid bar like so:


If you want to use multiple different horizontal rules at once, don’t fret. You can also use classes to define your dividers; ie:

<hr class="1">

This means you would also have a class 1 defined in your stylesheet so the horizontal rule can be differentiated from the other dividers.

Custom image rules

You can also use your own custom image and incorporate this into the <hr> tag. Simply get your image:

and find out its height and width correctly. In this case it is 230×5. We are now going to use this image as the background of the horizontal rule:


hr {
width: 230px;
height: 5;
border: none;
background: url(divimage.png) no-repeat;
margin:0 auto;
}

Test this out and it should work. You can use any sort of image for this CSS - have fun!!

  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • TwitThis
  • Facebook
  • Mixx
  • Technorati
  • Ma.gnolia
  • Google
  • feedmelinks
  • Spurl
  • Live
  • NewsVine
  • Sphinn
  • MisterWong
<3 Love this post?
Loading ... Loading ...

See also...

Leave a Reply

Switch Themes;
Home | About | Contact | Links | elusionerie.com
© elusionerie.com 2008.
Layout adapted from the Foliage layout @ 5ThirtyOne. | Top
Epichronicity is proudly powered by WordPress
Entries (RSS) and Comments (RSS).