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 July 15th, 2002, 07:29 PM
iostream713 iostream713 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 6 iostream713 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
why does this css example wrap?

<html>
<head>
<style type="text/css">
.block{
background-color:red;
width:200px;
height:200px;

}

.header{
background-color:gray;
width:10px;
padding:3px 3px 3px 3px;
}

.content{
background-color:blue;
width:100%;
height:100%;
padding:10px 10px 10px 10px;
}
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<!-- outer block -->
<div class="block">
<div class="header">header</div>
<div class="content">

<!-- inner block -->
<div class="block">
<div class="header">sub header</div>
<div class="content">sub content</div>
</div>

</div>
</div>
</body>
</html>


if you look at it, you'll see that the header in the "inner block" wraps (what i don't want), while the one in the "outer block" doesn't. why is this, and how can i fix?

Reply With Quote
  #2  
Old July 15th, 2002, 07:47 PM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 16
I'm far from a CSS expert, but it looks to me like the problem is that you've defined the width of the header space to 10px. When I changed the "Outer Block" header content to something longer than the single word 'header' it wrapped too.


wdn2k

Reply With Quote
  #3  
Old July 15th, 2002, 08:01 PM
iostream713 iostream713 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 6 iostream713 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i did that on purpose, so that any text would fit there, and the padding would provide a border.

why would it wrap in one, and not the other? they're the same class

Reply With Quote
  #4  
Old July 15th, 2002, 08:10 PM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 16
Perhaps I wasn't clear in my reply. BOTH of them wrapped when they had more than one word in them. In fact, if when I seperated the word header into individual letters 'h e a d e r' it displayed vertically! I'm guessing this is because 10px isn't enough room for even two characters to sit side by side without wrapping. The only reason that the word 'header' doesn't wrap is because there are no spaces in it, so the browser doesn't know where to break it. Try putting 'headerheaderheaderheader' into the first one, it won't wrap because there aren't any spaces.


wdn2k

Reply With Quote
  #5  
Old July 15th, 2002, 08:14 PM
iostream713 iostream713 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 6 iostream713 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
oooooh, ic ic. that makes sense then.

what i was trying to do was make a box that would just surround my text, guess this isn't the way =)

Reply With Quote
  #6  
Old July 16th, 2002, 03:10 AM
MJEggertson MJEggertson is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2002
Location: Seattle WA
Posts: 863 MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 8
I've used that trick too, assign stupidly small dimensions, and allow the browser to stretch. Key is not to use breaking elements (spaces, hyphens, etc).

Brush up on your html entities. Specifically, use the &nbsp; in place of spaces (Non Braking SPace), the browser won't break them.

Reply With Quote
  #7  
Old July 16th, 2002, 05:05 PM
iostream713 iostream713 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 6 iostream713 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
awesome, thanks for that tip

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > why does this css example wrap?


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