[英]Css div width problem
i have div with 500px width which contains multiple anchors... problem anchors not wrapping in to multiple lines.... i tried using table as well same problem.... 我有500px宽度的div,其中包含多个锚点...问题锚点没有包裹到多行中。...我尝试使用表格以及同样的问题...。
<div style="width:500px;">
<a href="#procrit">procrit</a>
<a href="#doxil">doxil</a>
<a href="#prezista">prezista</a>
<a href="#simponi">simponi</a>
<a href="#reopro">reopro</a>
<a href="#topamax">topamax</a>
<a href="#invega">invega</a>
<a href="#axert">axert</a>
<a href="#aciphex">aciphex</a>
<a href="#concerta">concerta</a>
<a href="#risperdal">risperdal</a>
<a href="#remicade">remicade</a>
<a href="#velcade">velcade</a>
<a href="#doxil">doxil</a>
<a href="#regranex">regranex</a>
<a href="#nucynta">nucynta</a>
<a href="#duragesic">duragesic</a>
<a href="#leustatin">leustatin</a>
<a href="#invega">invega</a>
<a href="#sustenna">sustenna</a>
<a href="#reminyl">reminyl</a>
<a href="#natrecor">natrecor</a>
</div>
Try replacing
尝试更换
with just a space character. 只是一个空格字符。
prevents the browser from wrapping words it is attached to. 防止浏览器包装其附加的单词。 Each
<a>
will not appear on a new line, but it will successfully wrap if it no longer fits its container if using normal spaces. 每个
<a>
不会出现在新行上,但是如果使用常规空格,如果它不再适合其容器,它将成功包装。
If there is no white-space between the anchors, it is considered all one string and therefore can not wrap. 如果锚点之间没有空格,则将其视为所有一个字符串,因此无法换行。 You could try to use the CSS rule
word-wrap
to help with this, but some browsers may not honor such a setting. 您可以尝试使用CSS规则
word-wrap
来解决此问题,但是某些浏览器可能不支持这种设置。
Simple solution is to change
简单的解决方案是更改
to an actual spaces. 到一个实际的空间。 Or use a
<ul>
and have the <li>
display: inline;
或使用
<ul>
并display: inline;
<li>
display: inline;
. 。 The latter is arguably more semantic.
后者可以说是更具语义的。
Use float:left;margin-right:5px
使用
float:left;margin-right:5px
is a naughty way to force spacing; 是强制间隔的顽皮方法; you'll get much more consistent and professional results with good CSS (in this case,
margin
). 良好的CSS(在这种情况下为
margin
),您将获得更加一致和专业的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.