1 reply [Last post]
Duke Machesne
Duke Machesne's picture
Offline
newbie
Miami, FL
Last seen: 17 years 18 weeks ago
Miami, FL
Timezone: GMT-4
Joined: 2003-06-19
Posts: 7
Points: 0

Okay, suppose we got two divs, thing1 and thing2. Thing2 lives inside of thing1 (I learned today that there are some species of ticks in which the male lives its entire life inside of the female's vagina (you're welcome Wink )).

#thing1 { 
	/* Hi, I'm thing1 */ 
	position : absolute;
	width : 95%; 
	height : 100px; 
	background-color : blue; 
} 

#thing2 { 
	/* Hello, I'm thing2 */
	position : absolute;
	top : 33%;
	left : 100px;
	width : 100%; 
	height : 33%; 
	background-color : green;
}


We want to make thing2 fill all the available width of thing1 and no more. width:100%; easy. But wait, there's a randomfactor.

#randomfactor {
	position : absolute;
	top : 0px;
	left : 0px;
	width : 100px; 
	height : 100%; 
	background-color : red; 
} 

Now our whole happiness is ruined! The glass is too full!

<div id=thing1>
   <div id=randomfactor></div>
   <div id=thing2></div>
</div>

Is there any good way to make thing2 happy again?

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 4 years 38 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

div { width:big; }

You remove the left:100px from thing2, it'll be happier then.

BTW if viewed in something other than IE / with a DOCTYPE, the green div appears off to the right anyway...

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.