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 September 24th, 2003, 02:08 AM
Ruy Ruy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Vancouver
Posts: 100 Ruy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Ruy
CSS: can an object be bigger then its parent?

Say you have this:

<p>
blah
<span> blah blah </span>
</p>

with the css:

p {
width: 100px
height: 100px

}

span {
width: 200px;
height: 200px;
top: 50px;
left: 50px;
}



As you can see, the span is twice as big as the p which contains it. In this case, the p object will stretch to accomodate the child (don't parents always? ) to 250x250 px.

If I were to set the overflow to hidden the p would remain at 100x100 px, but only the top left 50x50px portion of the span would display (the rest is clipped).

Is there a way (in CSS *alone*) to somehow get BOTH elements to display at their defined size (i.e. the span "floats" on top of the p) WHILE still being able to maintain the span's 50x50 offset RELATIVE to the p's dimensions. (in other words, absolute positioning is not the answer - unless I'm missing something).

Thanks,
Ruy
__________________
the DOM hates me

Reply With Quote
  #2  
Old September 24th, 2003, 06:14 AM
DEfusion DEfusion is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 288 DEfusion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 26 m 45 sec
Reputation Power: 6
You nearly answered it yourself in your question, try this:

Code:
span { 
width: 200px; 
height: 200px; 
float: left;
position: relative;
top: 50px; 
left: 50px; 
} 


If you come across problems with the <P> still taking up space as if it were including the span within it (not sure if and when it will occur - but I have a sneaky suspision that IE may want to do it that way) try using a clip on the <P> too.
Although you may have to fiddle with the positioning too.

-D

Reply With Quote
  #3  
Old September 24th, 2003, 08:56 AM
Ruy Ruy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Vancouver
Posts: 100 Ruy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Ruy
tried that - no go
and i have been messing around with positioning without much luck :P

Reply With Quote
  #4  
Old September 24th, 2003, 10:36 AM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 2,622 Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 2 h 20 m 44 sec
Reputation Power: 548
just remember to add display:block; to the css,
when you assign width, height, to a inline element.

Last edited by Akh : September 24th, 2003 at 10:38 AM.

Reply With Quote
  #5  
Old September 24th, 2003, 02:51 PM
Ruy Ruy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Vancouver
Posts: 100 Ruy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Ruy
actually for the particular thing I need this for it will be divs which are block elements by default (i think) - i used p and span as examples.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS: can an object be bigger then its parent?


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 1 hosted by Hostway