程序问答   发布时间:2022-05-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了div之间的小差距大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决div之间的小差距?

开发过程中遇到div之间的小差距的问题如何解决?下面主要结合日常开发的经验,给出你关于div之间的小差距的解决方法建议,希望对你解决div之间的小差距有所启发或帮助;

我已经尝试将字体大小设置为 0 没有边距或仅填充内容框,但它在 div 之间仍然有小间隙 知道为什么会发生这种情况吗?是否有任何解决方案可以解决此问题,因为我希望它没有间隙,因为没有边距填充

我用来包含 iframe 的 .vIDeo 内部也有间隙,我将 iframe 设置为 100% 高度,因此它采用 .vIDeo 容器的全高,但问题是当我查看 .vIDeo 的元素框时。视频的高度是 158 像素,当我查看 iframe 时,它​​是 154 像素,为什么会这样?

div之间的小差距

 .vIDeo-section-wrapper {
        wIDth: 100%;
        height: 300px;
        BACkground-color: whitesmoke;
        position: absolute;
        top: 180px;
        border-radius: 4px;
        border-top: orange 5px solID;
        border-bottom: orange 5px solID;
        Box-sizing: border-Box;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .vIDeo-section-Box {
        height: 90%;
        wIDth: 27%;
        border: solID black 5px;
        Box-sizing: border-Box;
        Box-shadow: 1px 1px 2px 2px rgba(0,0.5),-1px -1px 2px 2px rgba(0,0.5);
        Transition: ease-in-out 0.5s;
        overflow: hIDden;
    }

    .vIDeo-section-Box:hover {
        height: 93%;
        wIDth: 30%;
    }

    .vIDeo-section-Box > .vIDeo {
        wIDth: 100%;
    }

    .vIDeo-section-Box > .vIDeo > iframe {
        wIDth: inherit;
        Box-sizing: content-Box;
        border: none;
        height: 100%;
    }

    .vIDeo-section-Box > .subtitle-wrapper {
        border-top: rgba(0,0.5) solID 5px;
        height: 92px;
        wIDth: 100%;
        position: relative;
    }

    .vIDeo-section-Box > .subtitle-wrapper > .subtitle-header {
        padding-left: 5px;
        BACkground-color: white;
        Box-sizing: border-Box;
        padding-bottom: 0px;
        margin-bottom: 0px;
        border-bottom: 0px;
    }

    .vIDeo-section-Box > .subtitle-wrapper > .subtitle-header > h {
        BACkground-color: black;
        color: wheat;
        Font-weight: bold;
        BACkground-size: 300px 300px;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        padding-left: 30px;
        padding-right: 30px;
    }

    .vIDeo-section-Box > .subtitle-wrapper > .subtitle-content {
        BACkground-color: black;
        margin: 0px;
        outline: 0px;
        height: 84px;
        color: wheat;
        display: flex;
        align-items: center;
        justify-content: center;
        Box-sizing: border-Box;
    }

    .capo-wrap {
        Font-size: 17px;
        position: absolute;
        color: wheat;
        display: flex;
        align-items: flex-end;
        height: 78px;
    }

    .capo-wrap > p{
        margin: 0px;
    }

    .vIDeo-section-Box > .subtitle-wrapper > .subtitle-content > .p {
        margin: 0px;
        padding-top: 0px;
        justify-content: center;
        align-items: center;
        text-align: center;
        Font-weight: bolder;
        Font-size: 30px;
    }
    <div class="vIDeo-section-Box">
      <div class="vIDeo">
          <iframe>

          </iframe>
      </div>

      <div class="subtitle-wrapper">
          <div class="subtitle-header">
              <h>TUNING</h>                    
          </div>

          <div class="capo-wrap"><p>Capo Fret :</p></div>

          <div class="subtitle-content">
              <div class="p">E A D G B E</div>
          </div>                    
      </div>
   </div>

解决方法

display: inline-block 添加到 .video-section-box > .subtitle-wrapper > .subtitle-header > h 选择器。像这样:

.video-section-box > .subtitle-wrapper > .subtitle-header > h {
    ...
    display: inline-block;
}
,

.video-section-box > .subtitle-wrapper > .subtitle 中将 @H_154_41@ma​​rgin-bottom: 0px; 更改为 @H_154_41@ma​​rgin-bottom: -1px; -header {

.video-section-wrapper {
        width: 100%;
        height: 300px;
        BACkground-color: whitesmoke;
        position: absolute;
        top: 180px;
        border-radius: 4px;
        border-top: orange 5px solid;
        border-bottom: orange 5px solid;
        box-sizing: border-box;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .video-section-box {
        height: 90%;
        width: 27%;
        border: solid black 5px;
        box-sizing: border-box;
        box-shadow: 1px 1px 2px 2px rgba(0,0.5),-1px -1px 2px 2px rgba(0,0.5);
        transition: ease-in-out 0.5s;
        overflow: hidden;
    }

    .video-section-box:hover {
        height: 93%;
        width: 30%;
    }

    .video-section-box > .video {
        width: 100%;
    }

    .video-section-box > .video > iframe {
        width: inherit;
        box-sizing: content-box;
        border: none;
        height: 100%;
    }

    .video-section-box > .subtitle-wrapper {
        border-top: rgba(0,0.5) solid 5px;
        height: 92px;
        width: 100%;
        position: relative;
    }

    .video-section-box > .subtitle-wrapper > .subtitle-header {
        padding-left: 5px;
        BACkground-color: white;
        box-sizing: border-box;
        padding-bottom: 0px;
        margin-bottom: -1px;
        border-bottom: 0px;
    }

    .video-section-box > .subtitle-wrapper > .subtitle-header > h {
        BACkground-color: black;
        color: wheat;
        font-weight: bold;
        BACkground-size: 300px 300px;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        padding-left: 30px;
        padding-right: 30px;
    }

    .video-section-box > .subtitle-wrapper > .subtitle-content {
        BACkground-color: black;
        margin: 0px;
        outline: 0px;
        height: 84px;
        color: wheat;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .capo-wrap {
        font-size: 17px;
        position: absolute;
        color: wheat;
        display: flex;
        align-items: flex-end;
        height: 78px;
    }

    .capo-wrap > p{
        margin: 0px;
    }

    .video-section-box > .subtitle-wrapper > .subtitle-content > .p {
        margin: 0px;
        padding-top: 0px;
        justify-content: center;
        align-items: center;
        text-align: center;
        font-weight: bolder;
        font-size: 30px;
        display: inline-block;
    }
 <div class="video-section-box">
      <div class="video">
          <iframe>

          </iframe>
      </div>

      <div class="subtitle-wrapper">
          <div class="subtitle-header">
              <h>TUNING</h>                    
          </div>

          <div class="capo-wrap"><p>Capo Fret :</p></div>

          <div class="subtitle-content">
              <div class="p">E A D G B E</div>
          </div>                    
      </div>
   </div>

大佬总结

以上是大佬教程为你收集整理的div之间的小差距全部内容,希望文章能够帮你解决div之间的小差距所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: