Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Empty ul with border only

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #269150
    salman83
    Participant

    hi,
    i am trying to create empty ul list with 1 px border with no list items but it still showing the content area height as 1 px but even i have set the padding to 0. How can i achieve the 0 pixel height of the content area but with 1px border. here is my code

    See the Pen mxxGZm by Salman ( @salman83) on CodePen.

    https://static.codepen.io/assets/embed/ei.js

    #269170
    Paulie_D
    Member

    i am trying to create empty ul list with 1 px border with no list items

    Why?…What is the point.>

    Just us a div if you must.

    #269177
    salman83
    Participant

    I know that. But i want to create an empty list first, then populate it later

    #269196
    Paulie_D
    Member

    Here’s the thing…a 1px border is actually 2px (top & bottom) and you can’t set a border-width to less than 1 px.

    So, if you want an element to be only 1px tall, it should have no content (or whitespace), no padding and only a single border..say border-top:1px solid black…and no other border.

    https://codepen.io/Paulie-D/pen/yKjaXv

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.