Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-13-2012, 10:03 PM   PM User | #1
joe2730
New Coder

 
Join Date: Sep 2011
Posts: 28
Thanks: 4
Thanked 0 Times in 0 Posts
joe2730 is an unknown quantity at this point
<hr /> issue

I have made two containers at the bottom of a page and I wanted to put a line underneather to separate them. But my line appears above the containers, and i'm not sure why? any ideas?
heres the html
Code:
    <div class="homeboxnames">
    	<a href="#">News</a>
    	</div>
    <div class="homeboxnames" style="float:right; margin-right:319px;">
    	<a href="#">Recent Photos</a>
    	</div>
    
    <div class="homeboxes">
    	containers
   		</div>
    <div class="homeboxes" style="float:right;">
    	containers 2
    	</div>
        <hr />
and the css
Code:
.homeboxnames {
	font-size:20px;
	text-align:center;
	display:block;
	background-color:#FF0000;
	padding:2px 20px;
	-moz-border-radius:7px;
	float:left;
	margin-bottom:10px;
}
.homeboxnames a{
	text-decoration:none;
}

.homeboxnames:hover{
	background-color:#CC33FF;
	
}
	
.homeboxes {
	width:490px;
	height:300px;
	background-color:#00FF00;
	float:left;
	margin-bottom:5px;
}
would I have to style the hr tag to appear at the bottom? If so what would it be?
thanks!
joe2730 is offline   Reply With Quote
Old 06-13-2012, 10:18 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,454
Thanks: 0
Thanked 498 Times in 490 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
All of the divs are floated so that takes them out of the regular flow. The <hr/> tag is not floated so it is still in the regular flow.

One fix would be to wrap the floated divs inside another div and specify overflow:hidden on that div to force it to contain the floated content. You can then put the <hr/> after that div.

ps. get rid of the space before the / as that was only necessary when serving the xode as HTML to Netscape 4 and is no longer necessary now that no one uses that browser any more.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Users who have thanked felgall for this post:
joe2730 (06-13-2012)
Old 06-13-2012, 10:23 PM   PM User | #3
joe2730
New Coder

 
Join Date: Sep 2011
Posts: 28
Thanks: 4
Thanked 0 Times in 0 Posts
joe2730 is an unknown quantity at this point
Sorted, and thank you for the advice aswell
joe2730 is offline   Reply With Quote
Old 06-13-2012, 10:25 PM   PM User | #4
Taro
Regular Coder

 
Taro's Avatar
 
Join Date: Oct 2011
Location: Geraldton, Ontario
Posts: 155
Thanks: 1
Thanked 1 Time in 1 Post
Taro is an unknown quantity at this point
Based on the attachment, I see that the divs may be floated, as the first container is stuck to the upper left-hand corner. The second container looks fine. Instead, you can try margin positioning, as they can be very precise in determining the correct location of the containers. For example:
Code:
#container
{
margin-top:100px;
margin-bottom:100px;
margin-left:100px;
margin-right:100px;
}
Attached Thumbnails
Click image for larger version

Name:	Untitled.jpg
Views:	9
Size:	47.3 KB
ID:	11280  
__________________
Element ID

Webs Support Helper

Your friendly neighborhood Taroman.
Taro is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:21 AM.


Advertisement
Log in to turn off these ads.