Category:Other
Stretched layout due to the comments

When an image is inserted in a reply in the guest book or in any other thread of the site, if the image exceeds the width allowed by the layout of your theme then this will cause the layout becoming stretched in the horizontal dimension: the raight rail goes beyond the right border of the browser's window and it will appear the horizzontal scroll bar and normally the layout will come messed.
You can get the same problem when in the comment you paste a long URL; generally this happens with any text made by a string that does not contain a blank space and it results also longer than the allowed width for your replies.

Here is what I know for solving the issue

First code - introducing scroll bars

The property overflow
This is the simplest natural thing for solving the issue.
The gift of this code is that is good in ALL the browsers and that it is simple.
Just note I cannot test it in mac world - I hope the behavior is the same that in Mozilla Borwsers (Firefox) and with ie7 too. Any feedback will be really appreciated.

/* Comments in the Guestbook in main page */
#home_guestbook .replybox, #home_guestbook .replyboxread {
overflow: auto;
width: 490px;
height: auto;
}
#home_guestbook .quotet {
overflow: auto;
width: 300px;
height: auto;
}
/* Comments in all the threads of the site */
.replybox, .replyboxread {
overflow: auto;
width: 490px;
height: auto;
}
.quotet {
overflow: auto;
width: 300px;
height: auto;
}
/* ie hack */
.replybodytext {
padding-bottom: 0 !important;
padding:0 5px 8px 5px;
}

First code - Variation - Fixed Heigth

It will works in any browser - Just you fix the height so that all the comment will have the same height ; when the comment is longer than the height then the browser will display the vertical scroll bar


/* Comments in the Guestbook in main page */
#home_guestbook .replybox, #home_guestbook .replyboxread {
overflow: auto;
width: 490px;
height: 300px;
}
#home_guestbook .quotet {
overflow: auto;
width: 300px;
height: 200px;
}
/* Comments in all the threads of the site */
.replybox, .replyboxread {
overflow: auto;
width: 490px;
height: 300px;
}
.quotet {
overflow: auto;
width: 300px;
height: 200px;
}

Second code - Resizing Images

The property max-width
this property says that any thing in the content of the box containing this property is exceeding the value assigned to max-width will be reduced to the max-width width; the bad thing is: max width is NOT recognized in Internet Explorer 6 (the most diffuse browser at this moment) and it works in IE 7 only in combination with display:block.

There is a chance for IE to use a propretary javascript code embedded in the css for simulate this property...but it seems does not work here in MP (cause of the limitation to the javascript use)
So for having the code realistically working in the site it is need to use both the methods: max - width and overflow, and the layout will be different depending by the used browser: with all compliant browsers you get the image resized; with ie 6 and previous versions you will get the scroll bar such as in the previous code.

/* Comments in Guestbook in main page */
#home_guestbook .replybox, #home_guestbook .replyboxread {
overflow: auto;
width: 490px;
height: auto;
}
#home_guestbook .quotet {
overflow: auto;
width: 300px;
height: auto;
}
#home_guestbook .replybox .replybody img, #home_guestbook .replyboxread .replybody img, #home_guestbook .replybox .replybody a img, #home_guestbook .replyboxread .replybody a img {
width: auto;
height: auto;
display: block;
max-width: 420px;
max-height: 400px;
}
#home_guestbook .quotet .replybody img, #home_guestbook .quotet .replybody a img {
width: auto;
height: auto;
display: block;
max-width: 270px;
max-height: 400px;
}
/* Comments in all the threads of the site */
.replybox, .replyboxread {
overflow: auto;
width: 490px;
height: auto;
}
.quotet {
overflow: auto;
width: 350px;
height: auto;
}
.replybox .replybody img, .replyboxread .replybody img, .replybox .replybody a img, .replyboxread .replybody a img {
width: auto;
height: auto;
display: block;
max-width: 420px;
max-height: 400px;
}
.quotet .replybody img, .quotet .replybody a img {
width: auto;
height: auto;
display: block;
max-width: 200px;
max-height: 400px;
}
/* ie hack */
.replybodytext {
padding-bottom: 0 !important;
padding:0 5px 8px 5px;
}

Important NOTES for all the codes

It is long I know - But it is interesting to read all this notes to better understand all the code

  • In the code I have assigned a value for the width in the comments and a smaller value for the width in the quote comments
    the bad thing of the code
    is that YOU HAVE TO FIND THE RIGHT WIDTH (and evenctually the right max-width) FOR YOUR THEME WITH TRIALS - no other way
    quote must have a smaller width for not exceeding the width of the reply box containing that; being width and heigth of the quote box smaller than the box of the containing reply box you avoid to get in the reply box it self the scroll bar cause of the quote's overflow.
    normally they are all set to auto and for this not working in ie.
  • if you use a liquid layout such as Skyline I'm sorry but I have not idea how to solve the issue.
    Normally in the liquid layout the width take up the whole available width of the window and so it isn't possible to assign a defined value for the width without changing the layout it self, so maybe we could say that in this kind of themes there isn't any problem relative to the stretched layout cause of the nature of the liquid layout
  • If u use both the codes for the guestbook and for all the comments then the code for all the threads will work in all the site except the guestbook in home page
    If u use only the code for all the threads, it will work in all the site included the guestbook in main page
    If u use only the code for the guestbook, it won't affect the other threads
    just use a separated code for the guestbook
  • Guestbook
    I use a different code for the guestbook cause you could use a different width for guestbook and for all the other replies
    More Note that you could have two different width for the guestbook, depending by the view you choose as single column or couble column for the guestbook
  • The property overflow: auto introduce the scroll bar in both the dimension horizzontal and vertical; the scroll bars are visible only when it is needs, that is when the content exceeds the width or the height; effectively I'm using this code only for the horizzontal scroll bar.
    it exist overflow-x and overflow-y for to use separated scroll bar only in respectively horizzontal and vertical dimension.
    Being these two properties part of css3 they are not completely implemented in all the browsers yet.
    Particularly I prefer do not use these last properties cause they are not recognized by Opera Browser; with that browser the content becomes illegible
  • The overflow auto does not create the horizzontal scroll bar in IE6 or former if no width is defined (width:auto won't work)
    The overflow auto does not create the vertical scroll bar in IE6 or former if no height is defined (height:auto won't work)
    I don't know the behavior of IE7
    will be appreciated any feed back on this
    I don't know the behavior of Mac's browser
    will be appreciated any feed back on this
  • About the IE HACK
    when ie make the horizontal scroll bar
    it does not increase the height for the amount of the scroll bar and in consequence the bottom of the reply box is hidden by the scroll bar so u have to use the vertical scroll bar to see the bottom.
    more .. of course ie add the vertical scroll bar.
    The hack add a padding bottom only in ie 6 or former versions.
    the ie hack at the moment not is a perfect solution
    I'm searching for some better code
  • about the height:auto;
    this is the default value; no need to add this line of code. I added that so it is clear where u can to change the height for the replies
  • possible value for Overflow Property
    • overflow: visible
      this is the default value [That is the value when it is not explicitly assigned the property for that block]
      the content is not clipped; eventual overflow overlaps near boxes or the box comes stretched
    • overflow: hidden
      The overflowing content is cut off
    • overflow: auto
      browsers will display a scroll bar when it is need
    • overflow: scroll
      it makes the scroll bar every time, also if it is no need
  • You could use a defined value for max-height as well ; so all the replies will have a max height; exceeding the value defined for max-height compliant browsers will make the vertical scroll bar too ( just exclude ie6 and older versions from this)
  • You could use a defined value for height; at this way all the replies will get the same height; it will work with all the browsers

It exist another code working only in IE / Win and in Safari 1.3+ for to wrap a long string such as an URL

word-wrap: break-word; /*only IE and Safari 1.3+*/

anyway using the overflow: auto for making the scrollbar it is no need to use this last code

Posting images in another guestbook

if you wanna put an image in another guestbook or in any other thread this is the normal code you will use

<img src="image_URL">

If the visited site does not use any trick then starting from the code above if you want to avoid to mess up that layout with a big image you have to built a box with the scroll bar containing the big image; for this you have to use this code one

<div style="overflow:auto; width:400px; height:450px; "><img src="image_URL"></div>

where you have to find empirically (that is with trials and corrections) the right width according to the theme where you put the comment
and you have to choose the height as you like (you could use height:auto; removing at this way the vertical scroll bar in any case)

Posting a Long URL in another guestbook

A long URL will stretch the layout where u put it
To avoid this the code to use is quite similar to the previous;

This_could_be_a_very_long_URL

starting from the text above if you want to avoid to mess up that layout you have to built a box with the scroll bar containing the big image; for this you have to use this code one

<div style="overflow:auto; width:400px;">This_could_be_a_very_long_URL</div>

where you have to find empirically (that is with trials and corrections) the right width according to the theme where you put the comment.

 

you could add many other usual properties such as background, border, text colour, font size, font family and so on..
at this way you could make a box for any message you make also if there aren't images or URLs into that
just for making some particular effect

for example you could make a comment using a box such as

<div style="overflow:auto; width:400px; height: 100px; padding:10px; margin:10px; color:white; background-color: black; background-image:none; font-size:14px; border:3px solid red;">The text of your comment goes here</div>

and it will look as

The text of your comment goes here

I want to thank tejasmidget for the code for wrapping text in IE and for the profitable debate.
and missingbits for the idea bout the max width for resizing the images


41 Comments
raoulbanzon wrote on Feb 24
Duh...So who uses those codes, the sender (to the comment box) or the guestbook owner? I'm not sure...
alogena wrote on Feb 24, edited on Feb 24
the guestbook owner =)
if you wanna put an image in another site with the scroll bar for not mess up the site
,, there is a similar code ..

you have to use HTML with the so-called css inline for that ..
as the code in this post is pure css

nice question
I ll make a post for that too
raoulbanzon wrote on Feb 24
ReviewReviewReviewReview
thanks. I know somebody who should try it. peace, out.

alogena wrote on Feb 24
no ill make an add to this post
raoulbanzon wrote on Feb 24
actually, I keep getting these huge images in my (prefered) narrow gstbk space. Thought it would be nice if a css code automatically shrink or limit them to a smaller size regardless of how huge they originally were sent. But if thats too much to ask I can always delete the 'ugh' stuff. No sweat.
alogena wrote on Feb 24
actually, I keep getting these huge images in my (prefered) narrow gstbk space. Thought it would be nice if a css code automatically shrink or limit them to a smaller size regardless of how huge they originally were sent. But if thats too much to ask I can always delete the 'ugh' stuff. No sweat.
the second code will work shrinking the images in all the compliant browsers and making the scrollbar in ie
alogena wrote on Feb 24, edited on Feb 24
.,.,., well I made an update to the second code.
alogena wrote on Feb 24
Duh...So who uses those codes, the sender (to the comment box) or the guestbook owner? I'm not sure...
I added the code for the sender to the comment box too
moimoiis wrote on Feb 24
I have to admit I am rather ignorant about anything technical. These codes: presumably I copy them then, where on the page should I paste them?, before or after there is a graphic causing the stretching? What I mean is, is there a way of presetting something to avoid the problem occurring?
Also, should the 1st and 2nd codes be both put in at the same time? In the same place or not? Sorry to sound so ridiculous, but I haven't a clue how to go about such things. What is liquid layout anyway please??
alogena wrote on Feb 24, edited on Feb 24
you have to use the first OR the second code in your site adding the code in your custom css
at the bottom of all your actual code (its simpler)
after you put the code in ur css automatically all the big graphics in your comments will get the scroll bar


Comment deleted.
moimoiis wrote on Feb 24
sorry to be a pest, I need to make sure I understand correctly before I mess about with the page. To solve the problem of overstrectching, I need to copy 3 sets of codes, i.e. for guestbook, all comments in threads, and height. Right? Do I just all 3 of them one after another at the bottom of the customize page, below the rest of codes already there?
Many thanks for your patience.
Comment deleted at the request of the author.
Comment deleted.
alogena wrote on Feb 24
nope one for guestbook and one for the all comments
the fixed height is a variation where u have all the height fixed

this is the more simple you could to use .
it is optimized for your layout


#home_guestbook .replybox, #home_guestbook .replyboxread {
overflow: auto;
width: 492px;
height: auto;
}
#home_guestbook .quotet {
overflow: auto;
width: 380px;
height: auto;
}
.replybox, .replyboxread {
overflow: auto;
width: 492px;
height: auto;
}
.quotet {
overflow: auto;
width: 380px;
height: auto;
}




Comment deleted at the request of the author.
Comment deleted.
Comment deleted at the request of the author.
alogena wrote on Feb 24
OMG
there is another glitch in the code with the horizontal scroll bar hiding the last row of the reply box .... GRRRRRRRRR
why IE is so .. so .. so ...
moimoiis wrote on Feb 24
alogena said
this is the more simple you could to use .
it is optimized for your layout
I just put in the code, it worked wonders!! Thanks a million. Does it mean that the problem of over sized graphic problem is totally done with from now on? Should I also put the 2nd code in for comments elsewhere, and the one for the height too?
moimoiis wrote on Feb 24
All sound quite intriguing. How do you make a box? I could even get my Blogs to go on the left side in a long vertical strip, a little wider than the right rail, so that my guestbook and the rest of the stuff can be rasied up considerably. I had it like that in the beginning when first used the page 3 months ago. But suddenly without my doing anything that I knew of, it's changed & no way I could changed it back however many times and ways I tried.
Would you please be so kind as to take a look at my page to see what I am on about? So that perhaps you could help me fix it? PLEASE!!
alogena wrote on Feb 24, edited on Feb 24
Does it mean that the problem of over sized graphic problem is totally done with from now on? Should I also put the 2nd code in for comments elsewhere, and the one for the height too?
with the first code you solve copletely that problem .. regard to the width of any image or any URL
but u have the height of any reply exactly as the real height

with the firs code - VARIATION
you give a FIXED HEIGHT TO ANY REPLY
till the reply has a height smaller it look with no difference
for any reply having the height greater than the height of wich u have fixed the code
you will get the horizontal scroll bar

just try it
it is more simple than to explain it
mostly for my english

change in the new code all the
height:auto;

with

height:300px;

and take a look
alogena wrote on Feb 24
All sound quite intriguing. How do you make a box? I could even get my Blogs to go on the left side in a long vertical strip, a little wider than the right rail, so that my guestbook and the rest of the stuff can be rasied up considerably. I had it like that in the beginning when first used the page 3 months ago. But suddenly without my doing anything that I knew of, it's changed & no way I could changed it back however many times and ways I tried.
as first you have to put the blog in DOUBLE COLUMN
->Customize My SIte -> go to the blog box and move that (drag and drop)

you can to dispose the boxes in double column from the bottom of the site

so drag all the item boxes you decide to have in double column towards the bottom of the layout
moimoiis wrote on Feb 24
alogena said
as first you have to put the blog in DOUBLE COLUMN
->Customize My SIte -> go to the blog box and move that (drag and drop)

you can to dispose the boxes in double column from the bottom of the site

so drag all the item boxes you decide to have in double column towards the bottom of the layout
I am sorry but I don't understand that. I did try to drag and drop many times, but they always jumped back to what it is now!! I don't dare to move things around too many times in case I make a big mess of it.
I did just now put in the codes for the fixed height. For now I don't notice any difference. But I do want to thank you for being so patient and so helpful with me.
alogena wrote on Feb 24, edited on Feb 25
you have to drag better ... ..just you release the left click in a bad moment

try with another browser it could result differento well Im not so expert in moving box .. maybe there is some trick I dont knownormalyy I search to move the boxes in any way
dont worry bout to mess it

**************** TEST ***********************



tejasmidget wrote on Feb 24
alogena said
max width is NOT recognized in Internet Explorer 6 (the most diffuse browser at this moment)
max-width = width expression in IE.
This will simulate max-width in IE 6 & earlier to resize the image:

#home_guestbook .replybody img {
display:block;
max-width:350px;
width:auto;
padding : 8px;
width:expression(
document.body.clientWidth > (500/12) *
parseInt(document.body.currentStyle.fontSize)?
"24em":
"auto" );
}
#home_guestbook .quotet {
display : none;
}

it is css, not javascript
1)because it is only applied to the img, it has no ill effect on skyline or any liquid layout
2)unfortunately, quotet is an image, so cannot be displayed as such on the homepage guestbook
3)em is fluid, where px is not. the image must be smaller than the body to avoid the scrollbars in IE
bax3tmiss wrote on Feb 24
thanks for the second code! i was really going to ask about resizing images! thanks!!!!!! =)
alogena wrote on Feb 25, edited on Feb 25
Review
I made a little update to the second code (resizing images)

and I have to better test the

/* ie hack */
.replybodytext {
padding-bottom: 0 !important;
padding:0 5px 8px 5px;
}

cause Im not sure of the behavior of ie7

I think Ill made some other modify soon

unfortunately ie is very problematic
alogena wrote on Feb 25, edited on Feb 25
Byron
I'd like if that would work ..
but I do not have seen that really
the quotets are not a problem cause it is possible to exclude those (probably)
the problem is that I do not see the resized image ^.^

the fact you see the quotets as wide is the proof that the code does not work
in some way
tought I m not totally sure that kind of code is not working at all
alogena wrote on Feb 25
TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTEST
alogena wrote on Feb 25, edited on Feb 25
Byron
now
you are persuading me
^.^

now you know why the quotets are large..
if you resize the browser lesser then the client width defined in the code and reload the page you will see all to the original size for the images


[ note resizing it does not work . - u have to reload the page if u resize the browser ]
I said you waht s the real thing to solve for
to catch this epical code


anyway
you are right
it works
^.^

Comment deleted at the request of the author.
tejasmidget wrote on Feb 25
Yes, I noticed the need to reload the page, but ordinarily one would have it set only one way.
I viewed it from 640x480 to 1280x1024.
Needs a little tweak, sure, but it's promising. I Like the other you pointed to.
Maybe possible to add it to the quotet as well only much smaller as you have done above with max-width
alogena wrote on Feb 25
Yes, I noticed the need to reload the page,
ahahhah
now I have found no :))))
crazy ie
I got before some freeze
and now it works resizing .

look in my home page the two images
and resize ie lesser or larger than 800px

anyway the code does not work in avlack ....






tejasmidget wrote on Feb 26, edited on Feb 26
alogena said
anyway the code does not work in avlack ....
nanabelajarcss wrote on Feb 26
ReviewReviewReviewReviewReview
great tutorial here!
as u saw on my page, i link this one...
thanx...
^_^
alogena wrote on Feb 26
tnx nana
I love u
alogena wrote on Feb 26, edited on Feb 26
ReviewReview
added another modify to the second version of the code
substantial for ie7 indeed ..
this code is really intricate to do and not simple to test it

mimisplace wrote on Apr 4
or you could just delete whats screwing up your page ... that works too hehehe.
alogena wrote on Apr 4
or you could just delete whats screwing up your page ... that works too hehehe.
yes it works .. but
this code works for the URL too ... so without the code u have to delete any Long URL posted in a comment
and all the big images in th comments (in the fixed theme normally the available width is about 600 pixel)

alogena wrote on Apr 4
btw
I found another very good area where to apply the scroll bar
I should to update the post ^_^
Add a Comment
How would you rate this thing? (optional)
   
CSS 4 MP
Join this Group!RSS FeedHelp on RSS FeedsAdd to My Yahoo
Report Abuse
© 2008 Multiply, Inc.    About · Blog · Terms · Privacy · Corp Info · Contact Us · Help