HTML List element : Sharing the parent width into equal parts

后端 未结 5 1901
無奈伤痛
無奈伤痛 2020-12-01 06:39

I have a parent

    and couple of
  1. items in that.

      &
5条回答
  •  一个人的身影
    2020-12-01 07:15

    Please note: The original poster edited their question to exclude percent after I posted this answer.

    Yes, you simply need to figure out the percent that each will use. In this case, 20%.

    Also, you have some slight problems with your HTML (missing quote and width= instead of the correct width:).

    
    
    1. Item 1
    2. Item 2
    3. Item 3
    4. Item 4

    Update:

    While you can get away without defining pixels by using a percentage, there is no way with block elements to get away without defining any width value (and width values are only valid as a unit or a percentage).

    Not that I'm suggesting you use tables, but table cells are the only elements in HTML that sort of behave like what you are asking for.

提交回复
热议问题