473,397 Members | 2,068 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,397 software developers and data experts.

Positioning of list-style-image

Hello,

I have an ul with a custom bullet symbol, like that:
ul {
list-style-image:url(foo.png);
}

Does anyone know a way to define the vertical alignment of the image?
I tried line-height, padding and margin but the results aren't very good.

I already googled a lot but it seems there's no answer :-(
Any idea is appreciated!

Chris

PS: Sorry, I have no example online.
Jul 21 '05 #1
6 50303

"Chris Leipold" <cl******@dietzk.de> wrote in message
news:2v*************@uni-berlin.de...
Hello,

I have an ul with a custom bullet symbol, like that:
ul {
list-style-image:url(foo.png);
}

Does anyone know a way to define the vertical alignment of the image?
I tried line-height, padding and margin but the results aren't very good.


How about editing the image, adding padding to or removing it from the top?

Jul 21 '05 #2
On Mon, 08 Nov 2004 11:26:08 +0100, Chris Leipold <cl******@dietzk.de>
wrote:
Hello,

I have an ul with a custom bullet symbol, like that:
ul {
list-style-image:url(foo.png);
}

Does anyone know a way to define the vertical alignment of the image?
I tried line-height, padding and margin but the results aren't very good.

I already googled a lot but it seems there's no answer :-(
Any idea is appreciated!

Chris

PS: Sorry, I have no example online.


There are no style rules to control this. Including some transparent
padding in the image itself might be your best shot at 'controlling' this.
Are you using this for list items that usually take no more than a single
line?

--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won't get any real work done. - J.Nielsen

Jul 21 '05 #3
Hi,
I have an ul with a custom bullet symbol, like that:
ul {
list-style-image:url(foo.png);
}

Does anyone know a way to define the vertical alignment of the image? There are no style rules to control this.

I feared so :-(
Including some transparent padding in the image itself might be your
best shot at 'controlling' this. That's the way I did it now. But the problem is that IE positions the
bullets different as other browsers. I have the choice between pad the
image for IE or any 'good' browser. My boss uses IE, so I have to bent
over...
Are you using this for list items that usually take no more than
a single line?

Yes, why do you ask?

Thanks for the info

Chris
Jul 21 '05 #4
Hi again,

Chris Leipold wrote:
I have an ul with a custom bullet symbol, like that:
ul {
list-style-image:url(foo.png);
}

Does anyone know a way to define the vertical alignment of the image?
I tried line-height, padding and margin but the results aren't very good.


I now found a workaround:
ul {
list-style:none;
}
li {
margin:0;
padding:0;
padding-left:40px;
background-image:url(../img/logo_faq.png);
background-repeat:no-repeat;
background-position:12px 8px;
}

It's not exactly right, but it does exactly what I want...

Chris
Jul 21 '05 #5
Chris Leipold wrote:

ul {
list-style:none;
}
li {
margin:0;
padding:0;
padding-left:40px;
background-image:url(../img/logo_faq.png);
background-repeat:no-repeat;
background-position:12px 8px;
}

It's not exactly right, but it does exactly what I want...


So what about those folks who browse with image loading off? They get
nothing? Lists with no bullet markers at all can be hard to read, so
you're potentially creating a usability problem here.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jul 21 '05 #6
Chris Leipold <cl******@dietzk.de> writes:
Hi again,

Chris Leipold wrote:
I have an ul with a custom bullet symbol, like that:
ul {
list-style-image:url(foo.png);
}
Does anyone know a way to define the vertical alignment of
the image?
I tried line-height, padding and margin but the results aren't very good.


I now found a workaround:
ul {
list-style:none;
}
li {
margin:0;
padding:0;
padding-left:40px;
background-image:url(../img/logo_faq.png);
background-repeat:no-repeat;
background-position:12px 8px;
}

It's not exactly right, but it does exactly what I want...


Might not something like this be more appropriate:

@media screen {
li:before {display: marker;
content: url("../img/logo_faq.png");
vertical-align: 8px; /* choose this ... */
padding-right: 12px; /* and this */
}
li {list-style-type: none; }
}

As far as I can tell, setting the list-style-type to none
shouldn't be necessary; to quote REC-CSS2:

When the 'display' property has the value 'marker' for
content generated by an element with 'display:
list-item', a marker box generated for ':before' replaces
the normal list item marker.

but firefox 1.0PR displays both a bullet and an image if I leave
it out.

--
Jón Fairbairn Jo***********@cl.cam.ac.uk

Jul 21 '05 #7

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

Similar topics

16
by: Vincent | last post by:
First, here is a page to help you figure out what I'm talking about: http://relinquiere.free.fr/test.html As you can see in the source of this page, the structure is the following : - a banner...
14
by: Harlan Messinger | last post by:
What am I not understanding about the definition of { position: absolute; }? "The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These...
3
by: Roamer | last post by:
Can someone please help with table positioning on this page http://rmhh.co.uk/occup/Test3.html It parses fine for me and nearly all my users, but some, using IE6 and NS7.1 report row...
6
by: Stan Brown | last post by:
http://www.acad.sunytccc.edu/instruct/sbrown/stat15/demo.htm http://www.acad.sunytccc.edu/instruct/sbrown/npscreen.css The first table is floated right (class="fr"). Text does not flow around...
2
by: Tim Charles | last post by:
Hello I am close to finishing my first properly css-friendly site (at least I hope it is), and am looking for some general feedback, plus a specific question answered, if possible. ...
1
by: David Dorward | last post by:
I'm trying to come up with a list of uses for relative positioning. Can anybody think of any I've missed? * Establishing a local positioning context on an element for the benefit of its...
8
by: yb | last post by:
Hi, Does an inline element become block element once it is positioned absolutely. I couldn't find this explicity mentioned in the spec. (css2)
1
by: Eric | last post by:
I have a page with some ASP.NET controls at the top and a datalist which might include anything from 1 to 25 elements below them, all laid out with absolute CSS positioning. The problem I'm...
13
by: Casimir Pohjanraito | last post by:
I have a list of links, with a thumbnail image hidden(resized) next to the link. Complete html&css at end of this post. CSS for the link resizes the image on a:hover. All is good, except the...
0
by: slaterino | last post by:
Hi, I am in the process of creating a web site at the following address: http://www.cca-ltd.co.uk/New/en/index.html At the moment when you hover over the navigation links a list appears on the...
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: 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?
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
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
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
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
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,...
0
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...

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.