Content Top
DAL Computer Help » Web Development Help » Web Development Help » CSS Help » padding error, div within div

Recommended Fix

Click here to fix Windows Errors and Optimize Windows Performance

Need Computer Help?
Register Now for FREE

padding error, div within div

Reply
Thread Tools
CSS Help
  #1 (permalink)  
Old 14-06-2007, 10:50 AM
manuleka's Avatar
Junior Member
New Recruit
 
Join Date: Feb 2005
Posts: 47
manuleka Is a beginner here at D-A-L
Send a message via MSN to manuleka
padding error, div within div

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 27-06-2007, 05:39 PM
HappyBeaver's Avatar
Bea*ering Away!
Loyal Contributor
 
Join Date: May 2004
Posts: 517
HappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furnitureHappyBeaver is beginning to become part of the furniture
Send a message via ICQ to HappyBeaver Send a message via AIM to HappyBeaver Send a message via MSN to HappyBeaver Send a message via Yahoo to HappyBeaver
Re: padding error, div within div

Have you tried editing the offending css in the div to 150px instead of 100%?
__________________

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-07-2007, 09:57 PM
Junior Member
New Recruit
 
Join Date: Apr 2007
Posts: 28
kwah Is a beginner here at D-A-L
Re: padding error, div within div

with the 10px margins, the outer div would be 150px and the inner div would be 130px (plus 10px either side = 150px)
and that is without even considering the 10px left and right margins ..

think of it like this:
Code:
||<<-------------------150px----------------->>||
||                                             ||
|| 10px margin | 120px INNER DIV | 10px margin ||
||                                             ||
does that make sense?


lol there are so many questions that need to be answered so please bear with me :P

- have you considered giving the inner div its own id or class?
- what browser are you using? does this happen on every browser? have you tried different browsers?
- darn ive forgot what else i was supposed to ask :/ sorry

it is a long shot that i thought of before i remembered that padding is an internal border (so affects content inside the internal div), but maybe you could try switching the order in which the width and padding around?
the reasoning behind it is that maybe (and it is a long shot) the width is being calculated from the left -- i mean, the width of the div is calculated, then the extra padding is added onto it ?
Quote:
width:100%;
margin:auto;
padding:5px;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
IE7 Beta Error Message: SysFader: iexplore.exe - Application error Ben.Quo General Internet Issues and Questions 1 04-08-2006 05:03 PM
i get this error at the start of windows Stop:d000014 Hard error lord69 Windows XP Help 5 16-05-2006 12:34 AM
blue screen error crash unknown error macall75 Windows XP Help 22 11-02-2006 01:47 AM
How Do I stop this Error message? . Runtime Error - Do you want to debug johnford60 Windows XP Help 1 29-09-2005 01:03 AM


All times are GMT +1. The time now is 07:45 AM.

Bottom Corner