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

后端 未结 18 2252
滥情空心
滥情空心 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条回答
  •  -上瘾入骨i
    2020-11-27 10:53

    I recently needed to mix inline and non-inline dt/dd pairs, by specifying the class dl-inline on

    elements that should be followed by inline
    elements.

    dt.dl-inline {
      display: inline;
    }
    dt.dl-inline:before {
      content:"";
      display:block;
    }
    dt.dl-inline + dd {
      display: inline;
      margin-left: 0.5em;
      clear:right;
    }
    The first term.
    Definition of the first term. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a placerat odio viverra fusce.
    The second term.
    Definition of the second term. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a placerat odio viverra fusce.
    The third term.
    Definition of the third term. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a placerat odio viverra fusce.
    The fourth term
    Definition of the fourth term. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a placerat odio viverra fusce.

提交回复
热议问题