ul property

Discussion in 'HTML' started by Edwin van der Vaart, Sep 26, 2004.

  1. 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>.
    --
    Edwin van der Vaart
    http://www.semi-conductor.nl/ Links to Semiconductors sites
    http://www.evandervaart.nl/ Under construction
     
    Edwin van der Vaart, Sep 26, 2004
    #1
    1. Advertising

  2. Edwin van der Vaart

    Neal Guest

    On Sun, 26 Sep 2004 16:56:47 +0200, Edwin van der Vaart
    <> wrote:

    > Good day to all,
    >
    > This sound crazy, but what's the standard css property for the <ul>.


    http://www.w3.org/TR/CSS21/sample.html - but of course this is merely
    typical.
     
    Neal, Sep 26, 2004
    #2
    1. Advertising

  3. Neal schreef:
    > On Sun, 26 Sep 2004 16:56:47 +0200, Edwin van der Vaart
    > <> wrote:
    >
    >> Good day to all,
    >>
    >> This sound crazy, but what's the standard css property for the <ul>.

    >
    >
    > http://www.w3.org/TR/CSS21/sample.html - but of course this is merely
    > typical.


    So the <ul> have a margin of 1.12em 0 and a margin-left of 40px and no
    padding.
    Thanx for the uri and info.

    Oh,
    Did you like the menu?
    Does it work ok?
    --
    Edwin van der Vaart
    http://www.semi-conductor.nl/ Links to Semiconductors sites
    http://www.evandervaart.nl/ Under construction
     
    Edwin van der Vaart, Sep 26, 2004
    #3
  4. Edwin van der Vaart

    Toby Inkster Guest

    Edwin van der Vaart wrote:

    > 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.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Sep 26, 2004
    #4
  5. Edwin van der Vaart <> wrote:

    >> http://www.w3.org/TR/CSS21/sample.html - but of course this is merely
    >> typical.

    >
    > 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?

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Sep 26, 2004
    #5
  6. Jukka K. Korpela schreef:
    > Edwin van der Vaart <> wrote:
    >
    >
    >>>http://www.w3.org/TR/CSS21/sample.html - but of course this is merely
    >>>typical.

    >>
    >>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?


    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/
    --
    Edwin van der Vaart
    http://www.semi-conductor.nl/ Links to Semiconductors sites
    http://www.evandervaart.nl/ Under construction
     
    Edwin van der Vaart, Sep 27, 2004
    #6
  7. Toby Inkster schreef:
    > Edwin van der Vaart wrote:
    >
    >
    >>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.


    IE adds a small horizontal margin in the <li>.

    > 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.
    --
    Edwin van der Vaart
    http://www.semi-conductor.nl/ Links to Semiconductors sites
    http://www.evandervaart.nl/ Under construction
     
    Edwin van der Vaart, Sep 27, 2004
    #7
  8. Edwin van der Vaart <> wrote:

    > 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.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Sep 27, 2004
    #8
  9. Jukka K. Korpela schreef:
    > Edwin van der Vaart <> wrote:
    >
    >
    >>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).


    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.
    --
    Edwin van der Vaart
    http://www.semi-conductor.nl/ Links to Semiconductors sites
    http://www.evandervaart.nl/ Under construction
     
    Edwin van der Vaart, Sep 29, 2004
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Newton
    Replies:
    3
    Views:
    9,606
    Brock Allen
    Apr 4, 2005
  2. Joshua Beall
    Replies:
    1
    Views:
    474
    Bertilo Wennergren
    Dec 10, 2003
  3. Noozer
    Replies:
    10
    Views:
    2,240
    Mitja
    Oct 13, 2004
  4. Nathan Sokalski
    Replies:
    1
    Views:
    1,139
    =?Utf-8?B?SmVk?=
    Apr 29, 2006
  5. TS
    Replies:
    3
    Views:
    2,506
Loading...

Share This Page