CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 24th, 2003, 08:52 AM
phatnadz phatnadz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 30 phatnadz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
CSS question: DIVs within DIVs possible?

Is it possible to put a DIV within a DIV? I have a complex layout that will require a background DIV, and then multiple superimposed DIVs on top. It would be easy for me to just use absolute layout and z-index layering, but the problem is I need the background DIV to wrap around all the inside DIVs. In english: I need the background DIV to scale depending on the text withing the embedded DIVs. If that makes any sense. I tried testing embedded DIVs in IE and Mozilla but nothing happened. Is there an alternative to this? I don't really want to use HTML tables within DIVs... kinda makes the whole CSS positioning thing kinda worthless.

Here's my source:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin: 0px;
padding: 0px;
}
.background {
position: absolute;
left: 20px;
top: 20px;
width: 700px;
background-color: #CCCCCC;
border-top: 0px none;
border-right: 2px solid #999999;
border-bottom: 0px none;
border-left: 2px solid #999999;
}
.announcement {
position: absolute;
left: 30px;
top: 30px;
border: 0px;
width: 650px;
background-color: #99FF00;
}
-->
</style>
</head>

<body>

<div class="background">
<div class="annoucement">This is the annoucement.</div>
</div>

</body>
</html>

Last edited by phatnadz : August 24th, 2003 at 09:01 AM.

Reply With Quote
  #2  
Old August 24th, 2003, 01:22 PM
terminal's Avatar
terminal terminal is offline
nx
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: USA
Posts: 626 terminal Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 h 28 m 37 sec
Reputation Power: 0
Send a message via AIM to terminal
yeah, from what im aware of, it should work, but just be careful when you put more than 3 divs within a 'parent' div, cuz thats where you start to lose track of your ending tags(</div>).

Reply With Quote
  #3  
Old August 24th, 2003, 06:44 PM
jerom jerom is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Posts: 1,014 jerom User rank is Corporal (100 - 500 Reputation Level)jerom User rank is Corporal (100 - 500 Reputation Level)jerom User rank is Corporal (100 - 500 Reputation Level)jerom User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 17 h 34 m 25 sec
Reputation Power: 9
'announcement'
versus
'annoucement'

Oops (bloody typos)!

Hope this helps,
Jeroen

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS question: DIVs within DIVs possible?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway