1

我有一个使用 HTML 的项目符号列表,如果句子持续到两行,我希望单词对齐。如果文本进入第二行,它与项目符号对齐。我希望它与文本对齐。

这就是我的意思:

项目符号文本示例

这是我正在使用的代码:

项目符号文本代码

4

4 回答 4

0

您的代码末尾略有错误。你应该在你的<\li>之前关闭你的<\ul>,而不是相反。试试这个:

<TABLE style="BORDER-COLLAPSE: collapse; MARGIN-RIGHT: 8px">
<TBODY>
<TR>
<TD>
<UL>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Event will be held from 10am - 5pm Bring Your Dog With</SPAN></SPAN> </DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">$8 Entrance Fee (print out your flyer that you received and bring it with you to support your favorite Rescue (kids under 12 are FREE) $5 of you entrance fee will go to that dog rescue or organization</SPAN></SPAN> </DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">MUST bring Current Vaccination Paperwork, NO EXCEPTIONS, dogs will not be allowed in without this paperwork</SPAN></SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">No firearms, alcoholic beverages, outside food or drink, coolers or glass containers</SPAN></SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Bags will be checked prior to entrance</SPAN></SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Event will be photographed &amp; videotaped</SPAN></SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">All dogs MUST have rabies tags attached to collars</SPAN></SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Collars MUST be worn at all times, NO METAL COLLARS of any kind&nbsp;allowed</SPAN></SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Owners/Handlers are legally responsible for the behavior/actions of their dogs</SPAN></SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Only 1 dog allowed per adult handler</SPAN></SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Dogs must be healthy, fully immunized, de-wormed, &amp; wearing ID tags</SPAN></SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Female dogs in heat are NOT permitted</SPAN> </SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Dogs MUST be leashed at all times unless in dog play area, owners must watch their dog in this area at all times</SPAN></SPAN> </DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Owners MUST IMMEDIATELY clean up after their dogs, with a paper or plastic bag</SPAN> </SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">AGGRESSIVE dogs will be asked to leave</SPAN> </SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">MUZZLED dogs NOT allowed</SPAN> </SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Owners MUST keep their dogs under control at all times</SPAN> </SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Children MUST be closely supervised</SPAN></SPAN> </DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Please dispose of cigarette butts in proper areas, smoking not allowed in any building</SPAN> </SPAN></DIV>
<LI>
<DIV align=justify><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">People who do not follow the rules will be asked to leave immediately</SPAN> </DIV>
</LI></UL></TD></TR></TBODY></TABLE></DIV>
于 2012-06-14T13:53:21.367 回答
0

你不需要任何 div。你只需要设置你ul的样式。像这样:

ul.out{
 list-style:disc outside none;
}
于 2012-06-14T13:59:44.660 回答
0

你忘了关闭每一个 LI 标签..

而不是这个:

<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Event will be held from 10am - 5pm Bring Your Dog With</SPAN></SPAN> </DIV>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">$8 Entrance Fee (print out your flyer that you received and bring it with you to support your favorite Rescue (kids under 12 are FREE) $5 of you entrance fee will go to that dog rescue or organization</SPAN></SPAN> </DIV>

跟着这个:

<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">Event will be held from 10am - 5pm Bring Your Dog With</SPAN></SPAN> </DIV>
</LI>
<LI>
<DIV align=justify><SPAN style="FONT-SIZE: 14pt"><SPAN style="FONT-FAMILY: Times New Roman; FONT-SIZE: 14pt">$8 Entrance Fee (print out your flyer that you received and bring it with you to support your favorite Rescue (kids under 12 are FREE) $5 of you entrance fee will go to that dog rescue or organization</SPAN></SPAN> </DIV>
</LI>

另外,尽量保持标签小写。
我不确定,但我相信这是推荐的。

为确保行继续,而不是中断到下一行,请尝试设置:

ul {
overflow: auto;
}

在你的 CSS

于 2012-06-14T13:59:57.500 回答
0

你的代码太可怕了!如果您需要所有列表项的样式相似,请为所有列表项使用通用样式表!内部 div 和 span 没有任何理由!

<style type="text/css">
    li {
        font-size: 14pt;
        font-family: "Times New Roman", sans-serif;
    }
</style>
<ul>
    <li> event will be held from 10am - 5pm bring your dog with</li>
    <li> $8 entrance fee (print out your flyer that you received and bring it with you to support your favorite rescue
    </li>
    (kids under 12 are free) $5 of you entrance fee will go to that dog rescue or organization </li>
    <li> must bring current vaccination paperwork, no exceptions, dogs will not be allowed in without this paperwork
    </li>
    <li> no firearms, alcoholic beverages, outside food or drink, coolers or glass containers</li>
    <li> bags will be checked prior to entrance</li>
    <li> event will be photographed &amp; videotaped</li>
    <li> all dogs must have rabies tags attached to collars</li>
    <li> collars must be worn at all times, no metal collars of any kind allowed</li>
    <li> owners/handlers are legally responsible for the behavior/actions of their dogs</li>
    <li> only 1 dog allowed per adult handler</li>
    <li> dogs must be healthy, fully immunized, de-wormed, &amp; wearing id tags</li>
    <li> female dogs in heat are not permitted</li>
    <li> dogs must be leashed at all times unless in dog play area, owners must watch their dog in this area at all
        times
    </li>
    <li> owners must immediately clean up after their dogs, with a paper or plastic bag</li>
    <li> aggressive dogs will be asked to leave</li>
    <li> muzzled dogs not allowed</li>
    <li> owners must keep their dogs under control at all times</li>
    <li> children must be closely supervised</li>
    <li> please dispose of cigarette butts in proper areas, smoking not allowed in any building</li>
    <li> people who do not follow the rules will be asked to leave immediately</li>
</ul>
于 2012-06-14T14:00:53.213 回答