473,395 Members | 1,343 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.

want to ignore the width of "phantom" bullets while centering a <ul>

When using {list-style: none} to hide the bullets in a <ul>, the bullets
disappear but they are still accounted-for when positioning text.

Specifically, I have:

<div style='text-align: center'>
<ul style='list-style: none>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
</div>

I want the list items to appear so that the *text itself* is centered
within the div, *not* so the
text-plus-the-area-where-the-bullet-would-be is centered within the div.

Any suggestions?

-Jordan
Jul 20 '05 #1
3 2268
On Tue, 06 Jul 2004 15:21:49 -0500, Jordan Peterson
<em***@example.com> wrote:
When using {list-style: none} to hide the bullets in a <ul>, the bullets
disappear but they are still accounted-for when positioning text.

Specifically, I have:

<div style='text-align: center'>
<ul style='list-style: none>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
</div>

I want the list items to appear so that the *text itself* is centered
within the div, *not* so the
text-plus-the-area-where-the-bullet-would-be is centered within the div.

Any suggestions?


This kind of thing has served me well for making lists appear as
"normal text":

ul {
list-style: none;
margin: 0;
padding: 0;
}
li {
margin: 0;
padding: 0;
}

Setting the margins and padding seems to set all of the common
browsers I've tried straight. You can use values other than zero if
you like; the important thing is that there's some kind of setting
there to override the margin-left and padding-left that different
browsers use to make the "bullet space".

Good luck,
-Claire
Jul 20 '05 #2
Claire Tucker wrote:
This kind of thing has served me well for making lists appear as
"normal text":

ul {
list-style: none;
margin: 0;
padding: 0;
}
li {
margin: 0;
padding: 0;
}


Seems too simple, but sure enough, it works. I had tried setting
margins but was not setting the padding (no reason to, or so I thought).

Thanks much!
Jul 20 '05 #3
Jordan Peterson wrote:
Claire Tucker wrote:
li {
margin: 0;
padding: 0;
}


Seems too simple, but sure enough, it works. I had tried setting
margins but was not setting the padding (no reason to, or so I thought).


Some browsers use a left margin to create space for the marker, others
use left padding.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #4

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

Similar topics

15
by: Lee | last post by:
Often times, I do not want to specify the width of a div. Rather, I just want it to expand to be just wide enough to enclose its contents. Since this is how tables behave, I tried setting "div...
9
by: Summercool | last post by:
I wonder to show the images in a table format... and to set a box of width 100px and height 100px, is there a way? Right now, if I set width to 100px, then height can be 180px... If I set...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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:
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...
0
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...
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...

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.