Reply
padding divs within divs
Old 06-14-2007, 04:42 AM padding divs within divs
manuleka's Avatar
Average Talker

Posts: 15
Name: manu leka
ok i've got a block of div which contains another div within!
its floated to the right of my webpage.... here's the codes

style:
Code:
div.recent_proj{
	background-color:#b0b0b0;
	width:150px;
	position:relative;
	float:right;
	margin-right:10px;
	margin-left:10px;
	border:1px dashed #606060;
	text-align:center;
	color:#000000;
	font-family:tahoma,verdana,arial;
	font-size:11px;
	font-weight:bold;
	}

div.recent_proj div{
	position:relative;
	width:100%;
	margin:auto;
	padding:5px;
	background-color:#e0e0e0;
	}
div.recent_proj div a:link, a:visited{
	color:blue;
	font-weight:normal;
	text-decoration:none;
	}
div.recent_proj div a:hover{
	color:red;
	}
html:
Code:
<div id="r_proj" class="recent_proj">
	<br />Recent Projects<br /><br />
		<div>
			<a href="">Site Number 1:<br />
			Fill this space up with
			your site by clicking here!</a><br /><br />
			<a href="">Site Number 2:<br />
			Fill this space up with
			your site by clicking here!</a><br /><br />
			<a href="">Site Number 3:<br />
			Fill this space up with
			your site by clicking here!</a><br /><br />
			<a href="">Site Number 4:<br />
			Fill this space up with
			your site by clicking here!</a><br /><br />
		</div>
</div>
now what i get is that the inner div overlaps the outer/parent div when i add in the padding:5px on the div.recent_proj div

why is this happening? i was expecting the child div to only go as far as the 150px width of the parent div unless i insert picture or something wider than 150px!

can anyone enlighten me please
manuleka is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-14-2007, 11:12 AM Re: padding divs within divs
aithne's Avatar
Average Talker

Posts: 29
Name: Mary
Location: Oklahoma City, OK
Could you upload it so we can see what's going on for ourselves?
aithne is offline
Reply With Quote
View Public Profile Visit aithne's homepage!
 
Old 06-14-2007, 12:52 PM Re: padding divs within divs
LadynRed's Avatar
Super Moderator

Posts: 6,562
Location: Tennessee
If you're going to use floats, you must CLEAR those floats.

http://css-discuss.incutio.com/?page=ClearingSpace

I don't see why you don't use an unordered list for your navigation, it would be a better implementation than stacking links inside a div.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to padding divs within divs
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13514 seconds with 12 queries