Website Coding

Stuck on a line of code? Find resources and post your coding questions here.

Forum Sponsor (Advertise with us)
Reply
 
Thread Tools Display Modes
    #1 (permalink)  
Old 09-10-2011
dognose's Avatar
dognose dognose is offline
Active Member
Company name: Laserdog Productions
 
Join Date: Jan 2009
Location: Lafayette, CO
Posts: 882
Question I need help with nested div tags, please.
I'm missing something simple about nested div tags. For some reason, I have occasional issues with content falling outside of the main div tag. I have to set a min-height in the main div to compensate for this.

Here's a screen shot. The red circled text should be in the white box.



HTML CODE:

HTML Code:
<div id="mainBox">
<div id="mainBoxImg"><img src="Images/img1.jpg" alt="joyfulGirl" width="214" height="237" border="0" />
</div>

<div id="centeredText2"><br /><h3><span style="font-size: 24px;">Imagine Waking up 3 Weeks from Today<br /> &amp; Instead of Feeling Drained . . . <br /><span class="blueTxt-bld"> Feel Rejuvenated!</span></span></h3><br /><br />
<h3>It <span style="font-style: italic;font-size: 18px;">is</span> possible.</h3>
<h3>You're not alone.</h3>
<h3>We will give you the <span style="font-style: italic;">right</span> information &amp; support.</h3>
</div>

<div id="myStory">
<img src="Images/img2.jpg" alt="nutrition" width="150" height="200" border="0" /><br /><p style="padding-top: 15px;"><a href="#Mystory">Click here to read Ann&quot;s story.</a><br /><p>
</div>
</div>	<!-- end mainBox div -->

CSS CODE:

Code:
/* ••••••••• start css for mainBox Div  •••••••••  */
.rejuv #mainBox {
	width: 970px;
	margin-left: auto;
	margin-right: auto;	
	background-color: #FFFFFF;
	border: 2px solid black;
	min-height: 300px;
}

.rejuv #mainBoxImg {
	width: 230px;
	float: left;
}

.rejuv #mainBoxImg img {
	padding-top: 20px;	
	padding-left: 15px;
}

.rejuv #centertedText {
	width: 490px;
	float: left;
	padding-top: 20px;
}

.rejuv #centertedText h3 {
	text-align: center;
	font-size: 16px;
	font-weight: bold;
	color: #2f4f4f;
}

.rejuv #myStory {
	width: 250px;
	float: right;
	margin-top: 20px;
	margin-bottom: 20px;
	text-align: center;
	font-weight: bold;
}

.rejuv #myStory a {
	color: #2f4f4f;
}

Thanks for any help.
__________________
Lezly Harrison
Laserdog Productions - Code that Doesn't Bite
Reply With Quote
    #2 (permalink)  
Old 09-10-2011
Codehead Codehead is offline
Contributing Member
 
Join Date: Apr 2007
Location: Portland, Oregon
Posts: 177
Default Re: I need help with nested div tags, please.
When you use float on an element like a DIV, the browser doesn't consider it's height when calculating the parent elements height. The solution is to add this right after the floated element and before the parent's closing tag:

Code:
<div style="clear: both;"> </div>
You can have a CSS class for this like this:

Code:
.clear {
   clear: both;
}
Let me know how this goes...

Reply With Quote
    #3 (permalink)  
Old 09-10-2011
dognose's Avatar
dognose dognose is offline
Active Member
Company name: Laserdog Productions
 
Join Date: Jan 2009
Location: Lafayette, CO
Posts: 882
Default Re: I need help with nested div tags, please.
Fantastico!

I edited three pages I was having issues with & now they all have equal bottom white space.

Thank you so much.
__________________
Lezly Harrison
Laserdog Productions - Code that Doesn't Bite
Reply With Quote
Reply

« Previous Thread | Next Thread »
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page
Display Modes
Linear Mode Switch to Linear Mode
Hybrid Mode Hybrid Mode
Threaded Mode Switch to Threaded Mode

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
Trackbacks are On
Pingbacks are On
Refbacks are Off

Forum Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Question] Meta tags on every page? ShelleyH General Website Design and Development 3 05-24-2009 01:06 AM
Meta Tags question PamH53 General Website Design and Development 7 01-07-2009 10:17 PM
Brand Tags by Noah Brier My Office Zilla Branding Your Business 3 05-21-2008 04:45 PM
Meta tags and Keywords Gems Virtual Office General Website Design and Development 4 03-06-2008 10:37 AM


All times are GMT -4. The time now is 03:20 AM.

Virtual Assistant Forums Advertising
Featured VA websites:

The Admin Chick

SetUFree Virtual Services

Delfosse Designs
Get featured!
Virtual Assistant Business Retreat
Create a Professional New Client Welcome Packet
Virtual Assistant Forums Advertising
Work from Home | Become A Virtual Assistant

© Virtual Assistant Forums 2013
All content and images are protected under copyright law and may not be reproduced in any way without express written consent.