473,513 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CSS floating element doesn't wrap

JHR
Hey all,

I'm trying to make a sidebar box float to the right of various items,
and for those items to wrap if a user shrinks his browser window.
Instead, in every browser I've tried except for Internet Explorer (in
Safari, Firefox, and other Mozilla-types), the box ends up overlapping
with the second and third rows of the text (which are in an ordered list
with some 'display: table-cell' formats defined in order to allow
specific alignment).

The first row raps correctly, but the subsequent ones overlap with the
text going physically behind the box; in Internet Explorer, all
left-aligned lines wrap in order to make room for the floating sidebar,
which is what I want. The only thing I've been able to do is set a
background color for the sidebar, which prevents the dotted line from
going through it but not the text. I've tried adding a 'clear: left' tag
to no avail.

I'll paste the code below, or you can look at the misbehavior in action at:

http://www.sigga.org/bad-css/index.html

Shrink the window to the left, and you'll see what happens. The top word
doesn't overlap and instead wraps, but the indented line overlaps with
the sidebox, which I really don't want (it should wrap instead).

[yes, I know it's missing the doctype, overall structure, etc., and
doesn't look like much of anything design-wise, this is just an example
pared down from my actual code to show the bad css.]

Any ideas what might be wrong? Incredibly grateful in advance,
JHR

==========
The barebones HTML code, with innards removed, looks like this (same as
at weblink above):

<div class="floating-sidebar">
<ul><li>random items, various formatting</li></ul>
</div>

<p>

<div class="first-line">text</div>
<ul>
<li class="subsequent-lines">
<span class="subsequent-line-part-1">text</span>
<span class="subsequent-line-part-2">text
<span class="subsequent-line-part-3">text
</span></span>
</li></ul>

The relevant (I think) CSS definitions (ie., I'm omitting things that
only relate to fonts, etc. as opposed to placement) are:

.floating-sidebar {
float: right;
padding: 7px;
border: 3px outset lightgray;
margin-right: 20px;
}

/* this next one wraps correctly */

.first-line {
margin-bottom: -10px;
margin-top: 25px;
border-top: 1px dashed #666633;
}

/* these next four, all on the same line but often repeated on several
lines, all fail to wrap around the sidebar */

.subsequent-lines {
display: table;
border-bottom: 1px dotted #666633;
padding: 2px;
padding-top: 4px;
width: 100%;
}

.subsequent-line-part-1 {
display: table-cell;
width: 65px;
}

.subsequent-line-part-2 {
display: table-cell;
}

.subsequent-line-part-3 {
}
Jul 20 '05 #1
3 10752
JHR <ne********@sigga.org> wrote:
I'm trying to make a sidebar box float to the right of various items,
and for those items to wrap if a user shrinks his browser window.
Instead, in every browser I've tried except for Internet Explorer (in
Safari, Firefox, and other Mozilla-types), the box ends up overlapping
with the second and third rows of the text (which are in an ordered list
with some 'display: table-cell' formats defined in order to allow
specific alignment).
IE doesn't support CSS tables.
http://www.sigga.org/bad-css/index.html

Shrink the window to the left, and you'll see what happens. The top word
doesn't overlap and instead wraps, but the indented line overlaps with
the sidebox, which I really don't want (it should wrap instead).


Your example makes no sense, your description of what you want to happen
doesn't clarify things, if anything it throws up more questions.

Don't post code to the group, validate your HTML and CSS first,
expecting us to correct your errors before we can get to the question
isn't likely to yield a good response.

--
Spartanicus
Jul 20 '05 #2
Spartanicus <me@privacy.net> wrote:
http://www.sigga.org/bad-css/index.html


Your example makes no sense, your description of what you want to happen
doesn't clarify things, if anything it throws up more questions.


Upon loading the example in Mozilla it makes some sense, set display to
inline if you want to format the list that way. Google for "ALA Taming
Lists" for a tutorial on how to format lists.

--
Spartanicus
Jul 20 '05 #3
JHR
> Don't post code to the group, validate your HTML and CSS first,
expecting us to correct your errors before we can get to the question
Well, that was the problem - the HTML and CSS does validate just fine,
it just produces unexpected behavior in browsers other than Internet
Explorer (which seems the reverse of what should happen, given that IE
doesn't support CSS tables, as you say).

However, changing the code as you suggest in your second message, to
make the display inline instead of table, causes the wrap to work
correctly. Thanks - precisely what I needed!

Spartanicus wrote:
JHR <ne********@sigga.org> wrote:

I'm trying to make a sidebar box float to the right of various items,
and for those items to wrap if a user shrinks his browser window.
Instead, in every browser I've tried except for Internet Explorer (in
Safari, Firefox, and other Mozilla-types), the box ends up overlapping
with the second and third rows of the text (which are in an ordered list
with some 'display: table-cell' formats defined in order to allow
specific alignment).

IE doesn't support CSS tables.

http://www.sigga.org/bad-css/index.html

Shrink the window to the left, and you'll see what happens. The top word
doesn't overlap and instead wraps, but the indented line overlaps with
the sidebox, which I really don't want (it should wrap instead).

Your example makes no sense, your description of what you want to happen
doesn't clarify things, if anything it throws up more questions.

Don't post code to the group, validate your HTML and CSS first,
expecting us to correct your errors before we can get to the question
isn't likely to yield a good response.

Jul 20 '05 #4

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

Similar topics

1
3315
by: Andrew Straw | last post by:
I'm running into trouble when calling a 3rd party library (the Intel IPP library to do some fast math on a P4 processor). This is on debian linux 2.6.7 using python 2.3.4. I've been using Pyrex...
3
2420
by: Andrew | last post by:
Hi I've tried a number of techniques but this one is causing me to wonder whether I'm going to have to go back to using tables to solve this: I want to have some text aligned to the left and...
16
7344
by: Michael Bernstein | last post by:
Hello, I've tried to solve this problem six ways from sunday, but I'm conceding defeat and asking for help at this point. The following site is rendering *very* oddly in Mozilla only. IE seems...
3
5621
by: Mark Tranchant | last post by:
On my site, I use a background image of a small arrow to denote links that lead away from my site. This page has four such links in the first section: http://tranchant.plus.com/notes/cable-wrap...
2
2191
by: Lee K. Seitz | last post by:
I stayed up late working on a CGI script and spent some time formatting my page with CSS. It looked fine in IE, which will be 95% of my audience, so I went to bed. Got up and looked at it in...
11
15081
by: Stephen Poley | last post by:
I'd like to float an image to the bottom of a DIV containing several paragraphs, so that it is positioned to the right of the closing paragraphs (and preferably below the closing paragraphs if the...
1
6269
by: bryanrite | last post by:
I have two floating divs within a 100% width container div. In IE when you resize the window to the point where the text should wrap, it wraps and extends the height of the container div. In...
9
5151
by: ssubbarayan | last post by:
Hi all, I am trying a program to convert floating point values to a byte array and printing the same to the screen.The idea behind this is we already have an existing function which can do byte...
4
32578
dlite922
by: dlite922 | last post by:
This is just barely above my head when it comes to css. I have a div that needs to contain rows of floating divs, but I need each row not to wrap on to the next one and continue to go right. The...
0
7265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7545
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7111
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
7539
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5692
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
5095
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
4751
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
461
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.