473,395 Members | 1,496 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,395 software developers and data experts.

UL margins with a floated img are off?

Hi,

I created a very simple page to illustrate my problem. All I'm trying
to do is float an image left with a margin and have the text on the
right wrap around the image and the text includes an unordered list.
The paragraphs all work fine, but the ul starts way over in the image
for some reason? It looks the same in Firefox and IE, so I don't think
it's a browser bug. The page link is below if someone wouldn't mind
taking a look at this and telling me how to fix it. This is so simple
and I can't figure out what's going on to save my life.

http://www.animaladoption.org/float.htm

Thanks!
Holli

Jan 2 '06 #1
7 3042
Hello,

It seems that the UL is not affected by the margin set by the IMG. It
seems to be affected by the body margin.

In my experiments, setting the UL margin to the IMG width + 25px seems
to do the trick. I put <ul style=""margn-left: 475px"> and that brought
the UL in step with your text.

Here's how the page looks in Microsoft FrontPage in WYSWYG mode:

http://home.comcast.net/~vikenk/test.jpg

I don't use WYSWYG mode for building a site, but it can sometimes
provide an inside look as to how IE "thinks". Note that when I've
highlighted the text, the UL spans the entire width of the page? This
seems to indicate that, in IE, <UL>'s are treated differently when it
comes to floats. But the same happens in FireFox as well.

I'm not sure why this is, as I'm not an expert. But, it seems that
setting the <ul> margin to include your IMG +25px width is a way around
the problem. Why 25px? It also seems that the <ul>'s "dot" (I can't
think of the proper term) isn't included in the margin. So in your
case, 445px IMG + 15px margin + ~15px for the "dot" = 475px.

Maybe someone who's more technically aware of HTML rules will be able
to provide a more thorough answer.

Viken K.

Jan 2 '06 #2
Viken Karaguesian wrote:
It also seems that the <ul>'s "dot" (I can't
think of the proper term)


Bullet ;-)
--
TomB - DrumScum
tomb <-at-> versateladsl <-punt-> be
http://www.duskmetal.be
Jan 2 '06 #3
TomB wrote:
Viken Karaguesian wrote:
It also seems that the <ul>'s "dot" (I can't
think of the proper term)

Bullet ;-)


List Marker :-D

--
Gus
Jan 2 '06 #4
hg*****@bcbsal.org wrote:
Hi,

I created a very simple page to illustrate my problem. All I'm trying
to do is float an image left with a margin and have the text on the
right wrap around the image and the text includes an unordered list.
The paragraphs all work fine, but the ul starts way over in the image
for some reason? It looks the same in Firefox and IE, so I don't think
it's a browser bug. The page link is below if someone wouldn't mind
taking a look at this and telling me how to fix it. This is so simple
and I can't figure out what's going on to save my life.

http://www.animaladoption.org/float.htm


This is one of those hornet nests with conflicting implementation by Fx
vs. IE/Opera regarding Lists and then also with floats thrown in for
good measure.

The proper way to do this IMHO, is to drop the margin-right declaration
onto img and to place the flow items into a div wrapper and apply a
margin-left:475px; to this wrapper. Fx, IE and Opera now render the same.

--
Gus
Jan 2 '06 #5
Thanks for your help guys. Both solutions would work only in my real
life page, they're wanting the text to wrap around the picture and
there happens to be a bulleted list beside the picture and one below
the picture which means I have to set a different margin for the ul by
the picture to get it to look right which seems hokey to me. This
seems like a no-brainer that should've worked in CSS1. Oh well, just
more fun with CSS.

Thanks!
Holli

Jan 3 '06 #6
hg*****@bcbsal.org wrote:
I created a very simple page to illustrate my problem. All I'm trying
to do is float an image left with a margin and have the text on the
right wrap around the image and the text includes an unordered list.
The paragraphs all work fine, but the ul starts way over in the image
for some reason? It looks the same in Firefox and IE, so I don't think
it's a browser bug. The page link is below if someone wouldn't mind
taking a look at this and telling me how to fix it. This is so simple
and I can't figure out what's going on to save my life.

http://www.animaladoption.org/float.htm


ul{list-style-position:inside}

--
Spartanicus
Jan 3 '06 #7
Spartanicus wrote:
hg*****@bcbsal.org wrote:

I created a very simple page to illustrate my problem. All I'm trying
to do is float an image left with a margin and have the text on the
right wrap around the image and the text includes an unordered list.
The paragraphs all work fine, but the ul starts way over in the image
for some reason? It looks the same in Firefox and IE, so I don't think
it's a browser bug. The page link is below if someone wouldn't mind
taking a look at this and telling me how to fix it. This is so simple
and I can't figure out what's going on to save my life.

http://www.animaladoption.org/float.htm

ul{list-style-position:inside}


Thank you for that. This allows the flowed items to shrinkwrap around
the float and with a little margin-right adjustment on the image, Fx, IE
and Opera render almost alike.

--
Gus
Jan 3 '06 #8

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

Similar topics

3
by: viza | last post by:
Hi! This: p#p1 { text-align:left; } p#p2 { text-align:center; }
3
by: Lee K. Seitz | last post by:
I'm redesigning this page for more up-to-date browser standards: <http://home.hiwaay.net/~lkseitz/hhs/winners.shtml>. Note the use of an "invisible" table to position the "visible" ones. I'm...
24
by: Thomas Mlynarczyk | last post by:
Hi, Here's what I have: <div> <img ...><br> Caption text </div> The div is floated left and has no width set, the content is centered, there are no margins or padding on the <img> (just a...
1
by: drdeadpan | last post by:
Hi, I've been reading about IE having issues rendering the correct margins in FLoated elements. Basically, my code renders fine in FF but not in IE. Look at this link in FF and IE to see what...
1
by: yb | last post by:
Hi, I'm looking for clarification of css 2.1 specification in section 8.3.1 "Collapsing Margins" The 6th bullet reads "If the top and bottom margins of a box are adjoining ..." I won't paste...
7
by: Mark | last post by:
Hi, I am creating application in VB 2005. and when I print report it adds extra 0.45 cm margin on left and top, and the reason for this is physical margins of printer. Is it possible to change...
11
by: listerofsmeg01 | last post by:
Argh! I'm going nuts trying to get a constant margin after a floated div that works cross browser. This works in IE but not Firefox: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"...
6
by: Paul Wake | last post by:
Do paragraph bottom margins overrule body margins? (To explain what I mean, http://www.xmission.com/~wake/computerrules.html has 5% margins, including the bottom margin, in IE, but not in Firefox....
10
by: crazeway | last post by:
The top margin of a nested div (#main) is pulling down its containing div (#middle) along with the 2 floated divs flanking it. This problem corrects itself and gives me the desired effect if I add a...
2
by: FairyLucy | last post by:
Hello web experts, a question form a lonely beginner in HTML and CSS crying out for help!!, I am trying to stack 5 images of the same dimensions next to each other horizontally as the top bar of...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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
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
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...

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.