[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


CSS Positioning

Posted on 2009-04-16
Medium Priority
Last Modified: 2013-11-19
I am trying to make a <hr> horizontal rule appear about 10 pixels above the bottom border regardless of how much content is in the containing <div> ... what is the best way to do this so that it works in all browsers and also stays in the right place regardless of  the the size of the browser window.

you may view my page at : www.pacificbusiness.com.au/zing/project3.html

Question by:v2au
LVL 43

Expert Comment

by:David S.
ID: 24163877
Any style you apply to it won't do much because it's overflowing the bottom of #mainContent which has a fixed height.

Author Comment

ID: 24164008
Hmm . can you take a look now , i have edited the page , mainContent is not overflowing.  

So if it is not overflowing.  is there a way to absolutely position the <hr> within the mainContent div regardless of how much content is contained within it ( as long as its not overflowing ) .  basically each
page is going to have a varying amount of content but i want the <hr> to be displayed at a fixed 10px above the baseline.   if this will not work , could you suggest another way of acheiving this (image replacement)  
basically i am a novice at this but very eager to learn.

LVL 43

Accepted Solution

David S. earned 2000 total points
ID: 24164322
The text isn't overflowing anymore but the <hr> is still.  Giving a fixed height to an element that contains text is usually a bad idea.

Anyway, one way to do this would be to give #mainContent position:relative to create a new positioning context and then use this rule:
#mainContent hr {
  bottom: 5px;
  left: 25px;
  margin: 0;
  position: absolute;
  width: 160px;

Open in new window


Expert Comment

ID: 24165816

Try to remove the <br> tag. If you don't want to remove the <br> tags then add this CSS along with your existing style

br {

this will solve your problem.
LVL 58

Expert Comment

ID: 39456130
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question