How to make an inline element appear on new line, or block element not occupy the whole line?

前端 未结 4 1716
不知归路
不知归路 2020-12-25 09:42

I can\'t figure out how to do this with CSS. If I just use a
tag, it works flawlessly, but I\'m trying to avoid doing that for obvious reasons.

4条回答
  •  甜味超标
    2020-12-25 10:05

    For the block element not occupy the whole line, set it's width to something small and the white-space:nowrap

    label
    {
        width:10px;
        display:block;
        white-space:nowrap;
    }
    

提交回复
热议问题