How to style dt and dd so they are on the same line?

后端 未结 18 2301
滥情空心
滥情空心 2020-11-27 10:12

Using CSS, how can I style the following:

Mercury
Mercury (0.4 AU from the Sun) is the closest planet to th
18条回答
  •  一个人的身影
    2020-11-27 10:44

    Here's another option that works by displaying the dt and dd inline and then adding a line break after the dd.

    dt, dd {
     display: inline;
    }
    dd:after {
     content:"\a";
     white-space: pre;
    }
    

    This is similar to Navaneeth's solution above, but using this approach, the content won't line up as in a table, but the dd will follow the dt immediately on every line regardless of length.

提交回复
热议问题