Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ hr line in a div

Posted by: jjordan33 Apr 1 2019, 04:00 PM

Hi,

I want to add a hr line into one of my css divs, and I can't seem to make it work. Can someone help me out please?

CODE

.topleft {
  position: absolute;
  top: -10px;
  left: 16px;
  color : #413839;
  padding-left: 150px;
font-family: "Andale Mono";
hr { width:100%; height: 1px; background: #fff }
}

Posted by: Christian J Apr 1 2019, 04:45 PM

You can create a line using the CSS "border" property on the DIV element, e.g. like this:

CODE
div {border-bottom: 1px solid red;}

In contrast, HR is an HTML element, and as such it must be placed where you want it to appear in the HTML structure:

CODE
<div>
foo
<hr>
bar
</div>

Posted by: pandy Apr 1 2019, 08:30 PM

Did you remember to add the HR to the HTML?

Posted by: jjordan33 Apr 2 2019, 05:22 PM

QUOTE(pandy @ Apr 1 2019, 09:30 PM) *

Did you remember to add the HR to the HTML?

.......

I did not.... glare.gif

Thank you both.

Posted by: pandy Apr 2 2019, 06:37 PM

I'm psychic! tongue.gif

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)