------------------------
h1
tab1 tab2 tab3
------------------------
text text | photo
text text | photo
text text | photo
text text | photo
text text | photo
text text |
text text text text text
text text text text text
In the above two column layout the text is floating around the right panel. This is easily achieved by right floating the right column, however this requires that the right column and its images are placed before the left column and the text in the html.
Given the possibility (who knows really but I'm not up for taking a chance) of losing page rank due to text content being lower down the page, how can I achieve the same result with the left column before the right in the html?
Updated:
I moved the image div after the text div. If the size of the image is dynamic you can use jQuery to set it dynamically
jsFiddle link
I read in that referenced thread that these images are a slideshow, does that mean you know the width and height of the right "floated" block?
IF so the following fiddle example may be an option, if not I don't think it's possible without keeping the images first in source.
IF so, it means inserting one empty div first in source, dimensioning it to match the images/slideshow area and floating it right for a "placeholder".. then add position relative to your main content area, and absolutely position the actual images/slideshow over the placeholder:
example fiddle : HERE
full code as per comments :
HTML:
CSS:
jQuery to detect heights if not explicitly set on
#sshow
:If you don't know the width and height of your image element
Having text content wrap around an element can only be done using
float
, and since the width and height of your images are not known in advance we'll have to use javascript. I think the easiest way would be to:float: right;
to position the image.This way you wont lose page rank (search engine will see the proper HTML) and users will have the desired layout.
The javascript would be as simple as
If width and height are always the same
We can fake it using CSS pretty easily by using a
pseudo-element
Here we create a fake 200x200 element before the textContainer and use it to save space for the imageContainer we put over using absolute positioning. For the absolute positioning to work you'll need a wrapper div around your textContainer and ImageContainer with
position: relative;
This works from IE6 on. Float it
left
and setwidth
to it. Your sidebar part getsmargin-left
that has to be same ammount as total width of floated part (take care with margins, borders and paddings as they count to total width too).JSfiddle: http://jsfiddle.net/easwee/reXaT/1/
Why not write your html in such a way that all the text occurs before all the images. Something like :