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
Active Member
Company name: Laserdog Productions
 
Join Date: Jan 2009
Location: Lafayette, CO
Posts: 856
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's Avatar
Administrator
Company name: Codehead LLP
My latest blog post: Mac Performance Benchmark App
 
Join Date: Apr 2007
Location: WA
Posts: 175
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...

__________________
"Imagination is more important than knowledge."
Albert Einstein
Reply With Quote
    #3 (permalink)  
Old 09-10-2011
dognose's Avatar
Active Member
Company name: Laserdog Productions
 
Join Date: Jan 2009
Location: Lafayette, CO
Posts: 856
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

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tip] Blog - Meta Tags VA Melissa Search Engine Optimization (SEO) 0 09-01-2010 05:52 PM
[Question] Meta tags on every page? ShelleyH Search Engine Optimization (SEO) 3 05-24-2009 12:06 AM
Meta Tags question PamH53 Search Engine Optimization (SEO) 7 01-07-2009 09:17 PM
Brand Tags by Noah Brier My Office Zilla Branding Your Business 3 05-21-2008 03:45 PM
Meta tags and Keywords Gems Virtual Office Search Engine Optimization (SEO) 4 03-06-2008 09:37 AM


All times are GMT -4. The time now is 11:18 AM.

International Virtual Assistants Association
Project Management for Virtual Assistants
Work from Home | Become A Virtual Assistant
Virtual Assistant Directory
Affordable Logo Design
Virtual Assistant Contracts
Virtual Assistant Forums Advertising

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