Reply
div box stretch - I know, I know...
Old 07-05-2009, 01:14 AM div box stretch - I know, I know...
Novice Talker

Posts: 8
Name: Bethany
Trades: 0
Okay, I know that this question has been asked many times because I searched here on the board. However, I am trying to figure out how to go about getting a div to auto resize without me telling it what size to go to. I hope that makes sense?

Kind of like when someone types content inside a box and that box stretches to fit the text. I hope that makes sense? Here is what the code I'm working with:

Code:
<div style="border:1px solid #c9d2d8;background-color:#ffffff;padding:5px;">
<b>Movie: </b><u>{SIMPLETEXT1}</u><br /><hr />
<img src="./images/rating/{SIMPLETEXT2}.png" width="100" height="20" alt="This movie was rated {SIMPLETEXT2} stars out of 5" title="This movie was rated {SIMPLETEXT2} stars out of 5" />
</div>
Now ignore the {SIMPLETEXT1} and {SIMPLETEXT2}.

What this is going to do is allow someone to enter in text for the movie title ({SIMPLETEXT1}), and then enter in the rating which is for example 1.5 ({SIMPLETEXT2}).

I hope this makes sense?

Now as it is, the box is automatically perfect on the height, it's the width that is driving me crazy. It automatically stretches across when it shouldn't.

Basically if someone puts in:

Movie: Bride Wars
Rating

The box is from the left of Movie all the way to as far as it can go here in this post for example. Hm, I hope this makes sense. I'm trying to explain it. lol

Hm, actually here's a screen of what it looks like and how it renders:


Now I want the box to just stretch only if it needs to. Like say just after Bride Wars is typed in there, the box stops instead of continually grows like it does in the upper picture.

Any ideas of what I'm doing wrong with the box width?

Last edited by Shorte85; 07-05-2009 at 01:31 PM.. Reason: Took off the height and width 100% off there, forgot to do that
Shorte85 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 07-05-2009, 12:37 PM Re: div box stretch - I know, I know...
LadynRed's Avatar
Super Moderator

Posts: 8,790
Location: Tennessee
Trades: 0
Quote:
It automatically stretches across when it shouldn't.
Why not ? You DID specify width: 100%, so it's doing exactly what you told it to do.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is online now
Reply With Quote
View Public Profile
 
Old 07-05-2009, 01:31 PM Re: div box stretch - I know, I know...
Novice Talker

Posts: 8
Name: Bethany
Trades: 0
Oops, sorry! I forgot to remove those out of there before posting it. LOL My bad! I edited the first post. I apologize for that.
Shorte85 is offline
Reply With Quote
View Public Profile
 
Old 07-06-2009, 08:30 PM Re: div box stretch - I know, I know...
Novice Talker

Posts: 8
Name: Bethany
Trades: 0
Anyone?
Shorte85 is offline
Reply With Quote
View Public Profile
 
Old 07-09-2009, 07:22 AM Re: div box stretch - I know, I know...
sagar2121's Avatar
Novice Talker

Posts: 11
Name: sagar
Trades: 0
Try This

<div style="width:100px; height:50px; color:#999999; border:1px solid #c9d2d8;background-color:#ffffff;padding:5px;">
<b>Movie: </b><u>{SIMPLETEXT1}</u><br /><hr />
<img src="./images/rating/{SIMPLETEXT2}.png" width="100px" height="20px" alt="This movie was rated {SIMPLETEXT2} stars out of 5" title="This movie was rated {SIMPLETEXT2} stars out of 5" />
</div>
__________________
web design louisiana
sagar2121 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to div box stretch - I know, I know...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11673 seconds with 13 queries