Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problems styling <hr>'s

Featured Replies

I have several hr's on a webpage and are styled as follows:

 

<hr color="#990000" size="0.5px" width="600px" />

This works fine and displays as I want it.

 

However, when I run it through an HTML validator, I get these errors:

 

Line 143, Column 20: there is no attribute "color"

<hr size="2" color="#990000" />

 

So I created a div id in my css file:

 

#hr {

color: #990000;

size: 0.5;

width: 400px;

}

 

Html:

 

<div id="hr">

<hr>

</div>

 

Doesn't work. Also tried class, no joy.

In addition to getting the first error I also get:

 

Line 170, Column 13: document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

<div id="hr">

 

 

I'm tempted to just ignore the errors as it works my way but I fear that may come back to bite me one day!

 

What am I doing wrong?

Edited by Webtastic

I have several hr's on a webpage and are styled as follows:

 

<hr color="#990000" size="0.5px" width="600px" />

This works fine and displays as I want it.

 

However, when I run it through an HTML validator, I get these errors:

 

Line 143, Column 20: there is no attribute "color"

<hr size="2" color="#990000" />

 

So I created a div id in my css file:

 

#hr {

color: #990000;

size: 0.5;

width: 400px;

}

 

Html:

 

<div id="hr">

<hr>

</div>

 

Doesn't work.

In addition to getting the first error I also get:

 

Line 170, Column 13: document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

<div id="hr">

 

I'm tempted to just ignore the errors as it works my way but I fear that may come back to bite me one day!

 

What am I doing wrong?

 

 

http://css-tricks.com/snippets/css/cross-browser-hr-styling/

Depending upon in which context but i'd say normally you're better off avoiding HR's and just apply a border to the section you need the rule i.e. to the bottom or top of a <p>, <div> etc...

  • Author

Depending upon in which context but i'd say normally you're better off avoiding HR's and just apply a border to the section you need the rule i.e. to the bottom or top of a <p>, <div> etc...

 

Hi there

 

I'm still struggling to get this working correctly.

Just to reiterate on what I'm trying to achieve:

 

A PARAGRAPH OF TEXT

-----HR LINE UNDERNEATH------

A PARAGRAPH OF TEXT

-----HR LINE UNDERNEATH------

A PARAGRAPH OF TEXT

 

The only way I can get the line showing in the color and size I want is to add this:

 

<hr color="#990000" size="0.5px" width="400px" />

 

My brain is fried from one of the validator tools which has kept me busy all day <_<

(got all my webpages passed eventually, accept this one with HR's! :angry3: )

 

Can you give me a simple example of how to add a line after each paragraph?

A div id or div class I'm guessing?

Hi there

 

I'm still struggling to get this working correctly.

Just to reiterate on what I'm trying to achieve:

 

A PARAGRAPH OF TEXT

-----HR LINE UNDERNEATH------

A PARAGRAPH OF TEXT

-----HR LINE UNDERNEATH------

A PARAGRAPH OF TEXT

 

The only way I can get the line showing in the color and size I want is to add this:

 

<hr color="#990000" size="0.5px" width="400px" />

 

My brain is fried from one of the validator tools which has kept me busy all day <_<

(got all my webpages passed eventually, accept this one with HR's! :angry3: )

 

Can you give me a simple example of how to add a line after each paragraph?

A div id or div class I'm guessing?

 

 

 

I've already shown you.

 

http://css-tricks.com/snippets/css/cross-browser-hr-styling/

 

Some browsers handle HR's differently. IE uses color, other browsers use background-color. Might be the other way around. So you have to assign both to your styles.

 

If you want to add a bottom border to a paragraph do this:

 

 

p {border-bottom:2px solid black}

 

Or, if you don't want all paragraphs to have a bottom border, use a class.

 

 

p.border {border-bottom:2px solid black}

 

<p class="border">Text goes here</p>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.