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

后端 未结 18 2254
滥情空心
滥情空心 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:40

    I usually start with the following when styling definition lists as tables:

    dt,
    dd{
        /* Override browser defaults */
        display: inline;
        margin: 0;
    }
    
    dt  {
        clear:left;
        float:left;
        line-height:1; /* Adjust this value as you see fit */
        width:33%; /* 1/3 the width of the parent. Adjust this value as you see fit */
    }
    
    dd {
        clear:right;
        float: right;
        line-height:1; /* Adjust this value as you see fit */
        width:67%; /* 2/3 the width of the parent. Adjust this value as you see fit */
    }
    

提交回复
热议问题