css - Floating big elements next to each other? -


just quick question regarding css positioning. have several "segments" on site 100% wide (fills screen), , want them floated next each other. first 1 visible, other ones off-screen. i've tried playing around positions , overflow property without luck. right pop down below each other instead of floating.

this work if elements did not exceed screen width, do, pop down said earlier. i've tried setting huge width "wrapper", 99999px. , setting segments 100%, fill whole 99999px width instead of screen.

any ideas?

jsfiddle example: http://jsfiddle.net/9xgpb/

do mean this?

example fiddle: here

i used favourite alternative floats, inline-blocks

if take out of fiddle has pretty (gaudy?) colours show allows min-width: 900px; on centered_content div work too, , removed absolute positioning menu content go below it, demo may find useful..

let me know if or if have questions


updated jquery , make corrections default word-spacing

new example: here

re: ie6/7 hack rightly mentioned in comments;

.segment {     display: inline-block;     overflow: hidden;     width: 0; } .segment {display: inline !ie7;} 

needn't "parse hack" if that's preference long second rule given [lte ie 7] somehow, , separately @ cannot combined original rule * hack or anything, won't work.. has in separate ruleset.

i discovered word-spacing might problem if relying on width hide, natural behaviour of inline blocks put 3-4px between elements space in between words, workaround correct word-spacing on wrapper

.segment-wrapper {    white-space: nowrap;    word-spacing: -4px; } 

then restore normal actual content divs, same place restore normal wrapping behaviour

.centered_content {     width: 900px;     margin: 0px auto;     background: #fcf;     white-space: normal;     word-spacing: 0; } 

and last, apart fun.. there's 2 effects in new fiddle - uncomment , comment other.. forgive me playing! :)


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -