ul property

  • Thread starter Edwin van der Vaart
  • Start date
E

Edwin van der Vaart

Good day to all,

This sound crazy, but what's the standard css property for the <ul>.
Because I have a menu which I have specified the css for the <ul>, see at
http://www.evandervaart.nl/test/

When I gone use an other <ul> in the content I need to specify the <ul>
with the css.
I tried for the ul {list-style: disc; margin: 1em; padding: 0em 0em 0em
2em; border: 0;}.
When I compare the <ol> and mine <ul> in Firefox, Opera, Galeon (under
Linux/Mandrake 9.2) and Firefox, Opera, IE (under Windows 2000). I see
that there is a little different of 1em margin/padding on the left hand
side.

What is the correct css property (setting) for the <ul>.
 
T

Toby Inkster

Edwin said:
This sound crazy, but what's the standard css property for the <ul>.

Is crazy. There is no "standard" was of displaying an unordered list.
Different browsers do different things by default. For example, Opera adds
a small vertical margin between list items; other browsers don't.

To be safe:
ul,li{margin:0;padding:0;list-style:disc}

and then add your customisations.
 
J

Jukka K. Korpela

Edwin van der Vaart said:
So the <ul> have a margin of 1.12em 0 and a margin-left of 40px and no
padding.

You may have missed the "this is merely typical" part.

Browsers are free to implement <ul> elements by default e.g. using some
padding properties and no margins. And even to apply a reasonable left
margin instead of 40px.

But what is your _problem_? Why would you use CSS to make a browser
behave in a manner that it would use without CSS?
 
E

Edwin van der Vaart

Jukka K. Korpela schreef:
You may have missed the "this is merely typical" part.

Browsers are free to implement <ul> elements by default e.g. using some
padding properties and no margins. And even to apply a reasonable left
margin instead of 40px.

But what is your _problem_? Why would you use CSS to make a browser
behave in a manner that it would use without CSS?

Well, my problem is that I already specified an unordered list for the menu.
When I would like to use the standard unordered list, then the unordered
list
the same properties as the menu.
See the bottom of the right colomn at:
http://www.evandervaart.nl/test/
 
E

Edwin van der Vaart

Toby Inkster schreef:
Edwin van der Vaart wrote:




Is crazy. There is no "standard" was of displaying an unordered list.
Different browsers do different things by default. For example, Opera adds
a small vertical margin between list items; other browsers don't.

IE adds a small horizontal margin in the said:
To be safe:
ul,li{margin:0;padding:0;list-style:disc}

and then add your customisations.

Thanx for the tip. I'll customize the unordered list.
 
J

Jukka K. Korpela

Edwin van der Vaart said:
Well, my problem is that I already specified an unordered list for
the menu. When I would like to use the standard unordered list, then
the unordered list the same properties as the menu.
See the bottom of the right colomn at:
http://www.evandervaart.nl/test/

I still don't see the problem - maybe because your example there is so
artificial (no real content).

But if you wish to specify some properties in CSS for one unordered list
only, by not affecting other unordered lists, it's simplest to assign
a class (say <ul class="menu">) and use a class selector (say
ul.menu { ... }) in CSS.

There's generally no way in CSS to "undo" the effects of some CSS rules,
in the sense of saying "use the browser defaults instead". You just need
to avoid specifying the rules as applicable to the elements that should
be left intact; and classes are the simple way.
 
E

Edwin van der Vaart

Jukka K. Korpela schreef:
I still don't see the problem - maybe because your example there is so
artificial (no real content).

It wasn't artificial. Only I made it artificial as an example to let you
see what I meant.
But if you wish to specify some properties in CSS for one unordered list
only, by not affecting other unordered lists, it's simplest to assign
a class (say <ul class="menu">) and use a class selector (say
ul.menu { ... }) in CSS.

Yes, I already know that.
I have a javascript, which was looking for a id="nav".
I added class="nav" in the <ul> and changed all the ul properties into
ul.nav.
The problem is solved. Now I can use the standard ul definition.
There's generally no way in CSS to "undo" the effects of some CSS rules,
in the sense of saying "use the browser defaults instead". You just need
to avoid specifying the rules as applicable to the elements that should
be left intact; and classes are the simple way.

Thanx for the info.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top