HighDots Forums  

Question about floating and position in HTML source

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Question about floating and position in HTML source in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alan Silver
 
Posts: n/a

Default Question about floating and position in HTML source - 05-30-2006 , 09:27 AM






Hello,

I'm not sure if this is a stupid question or not, so here goes. Suppose
I want to achieve the very common design layout as shown here...
http://www.kidsinaction.org.uk/floating.html This has a load of text
(waffle in this case) with a div floated over to the right.

If you look at the HTML, you will see that the HTML for the quick links
div comes before the actual content of the page. That makes it easy to
float over to the right, and have the content wrap around it.

Now, suppose I want to achieve the same visual effect, but have the HTML
for the quick links *below* the HTML for the content. Can this be done?
I know I could use absolute positioning, but then the links div would be
taken out of the document flow, so I would have to set a right margin on
the content, meaning that it would not wrap underneath the links div.

Can this be done? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)

Reply With Quote
  #2  
Old   
pecan
 
Posts: n/a

Default Re: Question about floating and position in HTML source - 06-10-2006 , 04:33 AM






Alan Silver wrote:
Quote:
Hello,

I'm not sure if this is a stupid question or not, so here goes. Suppose
I want to achieve the very common design layout as shown here...
http://www.kidsinaction.org.uk/floating.html This has a load of text
(waffle in this case) with a div floated over to the right.

If you look at the HTML, you will see that the HTML for the quick links
div comes before the actual content of the page. That makes it easy to
float over to the right, and have the content wrap around it.

Now, suppose I want to achieve the same visual effect, but have the HTML
for the quick links *below* the HTML for the content. Can this be done?
I know I could use absolute positioning, but then the links div would be
taken out of the document flow, so I would have to set a right margin on
the content, meaning that it would not wrap underneath the links div.

Can this be done? TIA

Has there been a solution to this, as I'd like to know the answer?

CM

--
== Not nuts, just a little eccentric ==
http://www.africanbush.co.za
African Bush Tours and Safaris


Reply With Quote
  #3  
Old   
Spartanicus
 
Posts: n/a

Default Re: Question about floating and position in HTML source - 06-13-2006 , 02:19 AM



pecan <pecan.nospam (AT) iafrica (DOT) com> wrote:

Quote:
Has there been a solution to this, as I'd like to know the answer?
It's not possible.

--
Spartanicus


Reply With Quote
  #4  
Old   
Spartanicus
 
Posts: n/a

Default Re: Question about floating and position in HTML source - 06-13-2006 , 04:28 AM



Spartanicus <invalid (AT) invalid (DOT) invalid> wrote:

Quote:
Has there been a solution to this, as I'd like to know the answer?

It's not possible.
I should have said that it is not practical in most real world
scenarios. Only when the floated box has a width and height that changes
in a predictable manner can a dummy element with no content be floated
to "reserve" a space in the flow, the actual content could then be
positioned into that reserved space.

http://homepage.ntlworld.ie/spartani...oned_float.htm

In the real world the width and/or height of an element containing text
is rarely predictable due to client font size variations and possible
wrapping of the text content.

--
Spartanicus


Reply With Quote
  #5  
Old   
Alan Silver
 
Posts: n/a

Default Re: Question about floating and position in HTML source - 06-13-2006 , 10:32 AM



In article <Xns97E1FEBCD291httpwwwneredbojiasco (AT) 208 (DOT) 49.80.251>,
Neredbojias <http@?.neredbojias.com/fliam.php?cat=alt.html.invalid>
writes
Quote:
To further the education of mankind, Alan Silver <alan-
silver (AT) nospam (DOT) thanx.invalid> vouchsafed:
snip
Can this be done? TIA

Y U want to do this, I dunno,
Well, I can think of two reasons straight off. First, research suggests
that many (most?) search engines give more weight to text the further up
the HTML it is, all other factors being equal of course. If the first
part of your page contains nothing but a load of links, and the real
page content is further down, you are giving it (slight) disadvantage in
the SE indexing.

Second, if someone is using a text browser or screen reader etc, and
they load up a page and see piles of links, it doesn't exactly give them
a great browsing experience. Sure, you can (and should) add a "Jump to
main content" link at the top, but why subject them to that if you don't
have to? If you can put the content itself at the top, you are far more
likely to please people using such devices.

Quote:
but it could be done by using a placebo copy
of "quick links" with same dimensions and absolutely positioning the real
"quick links" div over it.
That's how I ended up doing it. I added an empty <div> at the start of
the content and floated it in the position where the links were to
appear. I had the HTML for the links lower down, and positioned these
absolutely over the empty <div>.

This works fine for link lists (or whatever) where you know the amount
of content in advance, but is more difficult if the links are generated
dynamically. It can still be done if you can assume (as is often the
case) that the links each take up one em vertically, and you know the
padding and margins. You then have to write out the height of the empty
<div> dynamically, based on the contents. It's messy, but works.

HTH

--
Alan Silver
(anything added below this line is nothing to do with me)


Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.