html - 将边界底部进一步向下移动?

标签 html css

有没有简单的方法可以将边框向下移动 5px?就像一些技巧会很棒......

   h2{
    display: inline-block;
    }
    .video{
    vertical-align: middle;
    }
    .item{
      border-bottom: 1px solid green;
    }
      <div class="item">
    <iframe class="video" width="200" height="100" src="//www.youtube.com/embed/" frameborder="0" allowfullscreen></iframe>
     <h2>title</h2>
    </div>

最佳答案

您可以通过 padding-bottom.item 容器的底部添加一些填充。属性:

.item{
    padding-bottom: 5px;
    border-bottom: 1px solid white;
} 

这可以在下面使用红线看到(因为很难看到白色):

enter image description here

示例

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <style>
    h2 {
      display: inline-block;
    }
    .video {
      vertical-align: middle;
    }
    .item {
      padding-bottom: 5px;
      border-bottom: 1px solid red;
    }
  </style>
</head>

<body>
  <div class="item">
    <iframe class="video" width="200" height="100" src="//www.youtube.com/embed/" frameborder="0" allowfullscreen></iframe>
    <h2>title</h2>
  </div>
</body>

</html>

关于html - 将边界底部进一步向下移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36802976/

相关文章:

javascript - 有没有好的 "email this"解决方案?

javascript - 在 JS 对象中引用 HTML 元素

html - 比浏览器宽度更宽的内容会破坏页面格式

javascript 输入字段或数组表现异常

javascript - 单击时如何旋转选择框的插入符号图标?

android - 安卓字体?

android - Cordova 请安装 Android target 19

javascript/css 循环图像和内容库 - 我的脚本的第一小部分不起作用

html - 为什么我的列表样式图像在不同浏览器中的位置不同

css - rails : How to create a link that loads the page with print. CSS?