html - 边框后的额外行

标签 html css

如果我使用此代码,不幸的是我会在虚线边框后得到额外的“行”。你能帮我吗,如何将边框后的“空格”设置为 0?

<td style="height:50px; line-height:10px; margin-top:10px;" >
   <div class="test"><p>test line 1</p></div>
   <div class="test"><p>test line 1</p></div>
   <div class="test"><p>test line 1</p></div>
   <div class="test"><p>test line 1</p></div>

</td>




.test {
    border-top-style:dotted; 
    border-top-width:1px; 
    border-top-color:#999;
    margin-top:-10px;
    margin-bottom:-10px;

 }

谢谢。

最佳答案

为什么不这样写呢?

<style type="text/css" media="screen">
  .test {
    padding: 0;
  }
  .test li{
    border-top: 1px #999 dotted;
    list-style: none;
    padding: 10px 0 0 0;
  }
</style>

<ul class="test">
  <li>test line 1</li>
  <li>test line 2</li>
  <li>test line 3</li>
</ul>

关于html - 边框后的额外行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2012340/

相关文章:

jquery - 使用 "columns.data"和 JSON 数据右对齐 JQuery 数据表单元格?

php - DOM xpath 查找#text 节点并包裹在段落标记中

css - Bobril - 关键帧规则

html - 我的手机不显示我网站的移动版

javascript - 如何使用向上或向下键在动态填充的 li 元素之间导航

javascript - 如何更改 iframe 的沙盒标志

html - 为什么这个 <audio> 不能在 Safari 中播放?

html - 编辑模板的动态导航选项卡

html - 如何使用 css 将 View 拆分为两列

css - 为跨浏览器灰度过滤器修改 jQuery 选择器