473,385 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 10738
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
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
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
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
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
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
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
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
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.