Jump to content

Hr Line


TCH-Thomas

Recommended Posts

First of all, don't use caps for HTML tags, especially if you're coding XHTML, since it's invalid code.

 

And remember to close your tags. In XHTML you *must* close all the tags. Those that didn't have a closing tag in HTML, like <img> and <hr>, should be written like <img /> and <hr />.

 

And I also suggest that you use CSS instead of the old HTML attributes, since all "presentation attributes" of the hr element were deprecated in HTML 4.01.

 

So... you can do it like this:

><hr style="color: #fff; width: 75%; height: 1px;" />

but even with 1px height it still shows like 2px, because it has the top and bottom lines. Try setting it to 10px to see what I mean.

 

By the way, the #fff is equivalent to #ffffff. CSS allows you to pack the colors definitions. A better example would be this: #5b2 = #55bb22.

 

At last, the solution I *don't* recommend: use the "size" attribute, like this:

><hr color="#FFFFFF" width="75%" size="1" />

but remember, this has been deprecated in HTML 4.01 and is not supported in XHTML - I tried using it on a page with the DOCTYPE set to XHTML 1.0, both Transitional and Strict, and the bar didn't show in any of them.

Edited by TCH-Raul
Link to comment
Share on other sites

Thanks Raul. :)

Not sure though if CSS works in CSB but I give it a try.

Also thanks for the extra info:

By the way, the #fff is equivalent to #ffffff. CSS allows you to pack the colors definitions. A better example would be this: #5b2 = #55bb22.

I always wondered why its only 3 letters in css fonts-color. Now I know. :dance:

 

-Thomas

Link to comment
Share on other sites

Ah. I see. Different browsers.

 

 

And I see dead people.

 

Stupid question, what's an hr line? That where you stand at the end of the week to get your paycheck?

 

Edit: Duh, never mind. Horizontal line. Gee Rob, next time just open notepad and see for yourself.

 

I am going back to packing now. :::::walking away in shame::::

Edited by TCH-Rob
Link to comment
Share on other sites

The basic tag for a horizontal rule, <HR> is still valid in HTML, but all its attributes were deprecated in HTML 4.0 (marked for future deletion).

 

You are correct Raul (no surprise :) ), you can use the background attribute in CSS and it will work in Explorer 5.x and 6.x, and Netscape 6.x browsers.

 

Ex.

 

HR {

height:1px;

width:50%;

background:#000066;

margin: 0px 150px 0px 150px;

}

 

I still prefer a simple gif file though ;)

Link to comment
Share on other sites

OK, I was starting to find it weird. I didn't had the time to check it but I was almost sure that you could style an <hr> line with CSS. Unless it was something that only worked on some browsers. I wasn't sure and didn't check it, hence my question. I don't use <hr> much, anyway, so... who cares? :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...