Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 定义列表中的文本对齐_Html_Css - Fatal编程技术网

Html 定义列表中的文本对齐

Html 定义列表中的文本对齐,html,css,Html,Css,我正在尝试使用定义列表对齐文本 下面是一个例子: 红色盒子停止后,我需要粉色盒子启动 html: <dl> <dt>Address</dt> <dd>Test <br /> Another Test <br /> A Final Test</dd> <dt>Phone</dt> <dd>Test</dd> <dt&g

我正在尝试使用定义列表对齐文本

下面是一个例子:

红色盒子停止后,我需要粉色盒子启动

html:

<dl>
    <dt>Address</dt>
    <dd>Test <br />
Another Test <br />
A Final Test</dd>

    <dt>Phone</dt>
    <dd>Test</dd>

    <dt>Fax</dt>
    <dd>Test</dd>

    <dt>Email</dt>
    <dd><a href="mailto:">email@testtesttesttest.org</a></dd>
</dl>
dl {
    margin-bottom: 40px;
    border-spacing: 0;
    background:green;
}
dd {
    display: inline-block;
    background:pink;
}
dd:after {
        display: block;
        content: '';
      }


dt {
    padding-left: 0;
    font-weight: bold;
    background:red;
    min-width:110px;
    width:110px;
}
添加此代码:

   dt {
      display: inline-block;
    }

    dd {
      margin-left: -4px;
  }
您还可以删除:after伪元素。

添加以下代码:

   dt {
      display: inline-block;
    }

    dd {
      margin-left: -4px;
  }
    dl {
    margin-bottom: 40px;
    border-spacing: 0;
    background:green;
}
dd {
    display: block;
    overflow: hidden;
    background:pink;
    margin: 0 0 5px;
}

dt {
    gin: 0 0 5px;
    padding-left: 0;
    font-weight: bold;
    background:red;
    min-width:110px;
    float: left;
}
您还可以删除:after伪元素。

添加以下代码:

   dt {
      display: inline-block;
    }

    dd {
      margin-left: -4px;
  }
    dl {
    margin-bottom: 40px;
    border-spacing: 0;
    background:green;
}
dd {
    display: block;
    overflow: hidden;
    background:pink;
    margin: 0 0 5px;
}

dt {
    gin: 0 0 5px;
    padding-left: 0;
    font-weight: bold;
    background:red;
    min-width:110px;
    float: left;
}
您还可以删除:after伪元素。

添加以下代码:

   dt {
      display: inline-block;
    }

    dd {
      margin-left: -4px;
  }
    dl {
    margin-bottom: 40px;
    border-spacing: 0;
    background:green;
}
dd {
    display: block;
    overflow: hidden;
    background:pink;
    margin: 0 0 5px;
}

dt {
    gin: 0 0 5px;
    padding-left: 0;
    font-weight: bold;
    background:red;
    min-width:110px;
    float: left;
}
还可以删除:after伪元素

    dl {
    margin-bottom: 40px;
    border-spacing: 0;
    background:green;
}
dd {
    display: block;
    overflow: hidden;
    background:pink;
    margin: 0 0 5px;
}

dt {
    gin: 0 0 5px;
    padding-left: 0;
    font-weight: bold;
    background:red;
    min-width:110px;
    float: left;
}
添加这些代码

添加这些代码

添加这些代码

添加这些代码

不幸的是,这对我不起作用。我需要粉红色的盒子和红色的盒子对齐。水平的。不幸的是,这对我不起作用。我需要粉红色的盒子和红色的盒子对齐。水平的。不幸的是,这对我不起作用。我需要粉红色的盒子和红色的盒子对齐。水平的。不幸的是,这对我不起作用。我需要粉红色的盒子和红色的盒子对齐。水平的。