gpt4 book ai didi

html - CSS对齐问题

转载 作者:行者123 更新时间:2023-11-28 15:02:53 26 4
gpt4 key购买 nike

这是我的标记,我需要在蓝色标签下对齐灰色标签,并使数字与蓝色标签对齐。

CSS:

body
{
font-family: arial, helvetica, sans-Serif;
}


#talkbacks .noshow
{
clear: both;
display: table; /*padding-left: 14px;*/
line-height: 13px;
width: 439px;
}


#talkbacks ul.top
{
border: solid 1px #fff;
margin: 0 -1px;
}

#talkbacks li
{
width: 100%;
margin-top: 11px;
}
#talkbacks ul
{

clear: both;
}



.n
{
color: #758888;
float: left;
font-size: 12px;
padding-right: 8px;
line-height: 15px;

}


.c
{
/*float: left;*/
width: 400px;
}

.d
{
font-weight: bold;
color: #758888;
font-size: 12px;
line-height: 15px;
margin: 0;
padding: 0;
}


ul
{
list-style-image: none;
list-style-position: outside;
list-style-type: none;
padding-left:0px;
margin-left:0px;
}
a
{
font-size: 12px;
line-height: 15px;
font-weight: bold;

}

a:link, a:visited
{
color: #284D99;
text-decoration: none;
outline: none;
}
a:hover, a:active
{
text-decoration: underline;
}

标记:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Test</title>
</head>
<body>
<ul>
<li>
<div class="noshow">
<div class="n">
<span id="ctl03_ctl00_ctl00_lblCommentNum">12.</span>
</div>
<div class="c">
<a href="javascript:__doPostBack('ctl03$ctl00$ctl00$LinkButton1','')" id="ctl03_ctl00_ctl00_LinkButton1"
onclick="viewHide(this);return false;">title3</a>
<p class="d">
marc,03/09/2009 12:23:40</p>
</div>
</div>
</li>
</ul>
<ul>
<li>
<div class="noshow">
<div class="n">
<span id="ctl03_ctl01_ctl00_lblCommentNum">12.</span>
</div>
<div class="c">
<a href="javascript:__doPostBack('ctl03$ctl01$ctl00$LinkButton1','')" id="ctl03_ctl01_ctl00_LinkButton1"
onclick="viewHide(this);return false;">blabla</a>
<p class="d">
bob,03/09/2009 12:23:55</p>
</div>
</div>
</li>
</ul> </body>
</html>

最佳答案

为这些特定修复替换类样式:

.n
{
color: #758888;
float: left;
font-size: 12px;
padding-right: 8px;
line-height: 15px;
width:15px;
}

为包含数字的 DIV 添加了宽度。标出 float 元素的宽度并没有坏处。如果您不想,则不必拥有它。

.c
{
float: left;
width: 400px;
}

取消注释掉您拥有的 float:left;。这将允许您在此特定 DIV 中拥有的文本 float 到其左侧,并与较早的保存数字的 .n 类对接。

.noshow
{
overflow:hidden;
clear:both;
}

这是重要的部分。第一行会将子元素保留在它们的父 DIV 中,而不是乱七八糟。否则,您将看到文档的其余部分步进。第二行只是确保 DIV 保持在自己的行上。

关于html - CSS对齐问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1388109/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com