473,503 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

float: right

Hello everybody,

I wonder why a

<span style="float:right">some text</span>

might be displayed out of a surrounding div element. It is shifted to the
next line.

I thougt it is supposed to appear inside the surrounding div. There is
definetly enough space.

tia,

Oliver

May 9 '06 #1
5 4902
Oliver Block wrote:
Hello everybody,

I wonder why a

<span style="float:right">some text</span>

might be displayed out of a surrounding div element. It is shifted to the
next line.

I thougt it is supposed to appear inside the surrounding div. There is
definetly enough space.

tia,

Oliver


Not true. You did not have sufficient content in the div. Without
commenting on your method, try this

<div>Here is a bunch of text<span
style="float:right;color:#f00;width:50px;">floated text</span> but some
text has been floated right that goes on and on that goes on and on that
goes on and on that goes on and on that goes on and on that goes on and
on that goes on and on that goes on and on that goes on and on that goes
on and on that goes on and on that goes on and on that goes on and on
that goes on and on that goes on and on that goes on and on that goes on
and on that goes on and on that goes on and on that goes on and on that
goes on and on that goes on and on that goes on and on that goes on and
on that goes on and on that goes on and on that goes on and on that goes
on and on
</div>

Now shift the <span> object to the start of the div content.

Louise
May 10 '06 #2
boclair wrote:
I thougt it is supposed to appear inside the surrounding div. There is
definetly enough space.


Not true. You did not have sufficient content in the div. Without
commenting on your method, try this


Why is that? I changed

<div style="width:100%"><a href="prev.html">prev</a><span
style="float:right;"><a href="next.html">next</a></span></div>

to:

<div style="width:100%"><span style="float:right;">
<a href="next.html">next</a></span><a href="prev.html">prev</a></div>

There is enough room!?

May that be a specialty of firefox? I did get no difference with Konqueror
(KDE) when I tried your code.

Thanks,

Oliver

May 10 '06 #3
To further the education of mankind, Oliver Block
<ne********@block-online.eu> vouchsafed:
boclair wrote:
I thougt it is supposed to appear inside the surrounding div. There
is definetly enough space.


Not true. You did not have sufficient content in the div. Without
commenting on your method, try this


Why is that? I changed

<div style="width:100%"><a href="prev.html">prev</a><span
style="float:right;"><a href="next.html">next</a></span></div>

to:

<div style="width:100%"><span style="float:right;">
<a href="next.html">next</a></span><a href="prev.html">prev</a></div>

There is enough room!?

May that be a specialty of firefox? I did get no difference with
Konqueror (KDE) when I tried your code.


In the first case you're floating (right) around nothing. In the second,
you're floating around the "prev" link.

--
Neredbojias
Infinity has its limits.
May 10 '06 #4
Oliver Block wrote:

<div style="width:100%"><span style="float:right;">
<a href="next.html">next</a></span><a href="prev.html">prev</a></div>

There is enough room!?

Try this:
#pager {
padding: 0.5em;
margin: 1em auto;
border: 1px solid red;
width: 90%;
}

<div id="pager">
<span style="float:right;"><a href="next.html">next</a></span>
<a href="prev.html">prev</a>
</div>

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
May 10 '06 #5
Neredbojias wrote:
To further the education of mankind, Oliver Block
<ne********@block-online.eu> vouchsafed:
boclair wrote:
I thougt it is supposed to appear inside the surrounding div. There
is definetly enough space.
Not true. You did not have sufficient content in the div. Without
commenting on your method, try this

Why is that? I changed

<div style="width:100%"><a href="prev.html">prev</a><span
style="float:right;"><a href="next.html">next</a></span></div>

to:

<div style="width:100%"><span style="float:right;">
<a href="next.html">next</a></span><a href="prev.html">prev</a></div>

There is enough room!?

May that be a specialty of firefox? I did get no difference with
Konqueror (KDE) when I tried your code.


In the first case you're floating (right) around nothing. In the second,
you're floating around the "prev" link.


Exactly. Floats are declared before the object that they are floated
around in the general case. Mozilla renders correctly and is not the
special case.

Having a width rule on a float set is good! practise.

Since the reason why is asked perhaps look at this.

_____start_____

<!-- left floated div -->
<div style="float:left;width:4em;border:1px solid #000;">left text</div>

<!-- right floated div -->
<div style="float:right;width:4em;text-align:right;border:1px solid
#000;">right text</div>

<!-- div in flow -->
<div style="width:4em;margin:auto;text-align:center;border:1px solid
#000;">centre text</div>

_____end________

and see http://www.w3.org/TR/REC-CSS2/visuren.html#floats and the Meyer
test suites at http://www.meyerweb.com/eric/css/tes...ec09-05-01.htm

Louise
May 10 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4302
by: Penguinny | last post by:
Dear all, I am trying to make a relatively simple layout with two adjustment columns filled with short news pieces, but there's a catch. I cannot control the html for these news bits, so I am...
2
5695
by: Dr. Richard E. Hawkins | last post by:
I've googled around, and asked everyone I know, but I still can't find any reference to anyone else having faced this particular IE bug with floats. I've put a page at...
6
5333
by: Jim Lawton | last post by:
I am trying to achieve a simple page layout using only divs and css. I know that people bad mouth IE for non-conformance, but in this case IE's(6.0)behaviour is entirely the way I expect, and Gecko...
11
3769
by: Joriveek | last post by:
I have a float variable like 123456789 I want to right truncate this and only display say only 8 right most values all the time or otherwise filled by zeros if it is less than 8 digits, do you...
0
2036
by: jonipony | last post by:
HELP: Float Left box is drifting to the right in ie! -------------------------- I need som HELP with my CSS coding! On the following web page my design falls apart at screen size 800 x 600...
3
1745
by: hantechs | last post by:
<html> <body> <p style="width:30%;">text1</p> <p style="float:left;">text2</p> </body> </html> The effect of this html code is : text1 and text2 each is on a line. My question is: Why text2...
22
51404
by: ashkaan57 | last post by:
Hi, I am trying to put text on left and right side of the page and used: <div> <span>blah blah</span> <span style="float:right">blah blah</span> </div> The 2nd text does go to the right but the...
5
15557
by: John | last post by:
Hi Suppose I want a header containing an image floated left and a list of horizontal links floated right. So I float the image left. I then do the following with the list: ul = float:...
27
3830
by: GloStix | last post by:
WARNING VIDEO TAKES A WHILE TO LOAD http://screencast.com/t/BWQ6DNtsM I really don't know how to fix this other than putting another div. But I dont' exactly want to do that for every page....
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.