简体   繁体   English

我对 HTML 和 CSS div 高度有疑问

[英]I have a problem whith HTML and CSS div height

I am trying to build a website where I occurred this error.我正在尝试建立一个发生此错误的网站。 Where I am trying to position an h1 element, but there is something coming between my way.我正在尝试 position 一个h1元素,但我的方式之间有一些东西。 Here This is the image the blue part is highlighted and coming in my way .这是蓝色部分突出显示并以我的方式出现的图像 I tried using inspect but it tells its a div called (our-team).but as per my CSS the div has height as much as the background image CSS code:-.我尝试使用检查,但它告诉它一个名为(我们的团队)的 div。但根据我的 CSS,div 的高度与背景图像 CSS 代码一样高:-。

.our-team{
height: 500px;
}

html code:- html 代码:-

  <div class="our-team">
      <img class="background-team" 
      src="https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg? 
      auto=compress&cs=tinysrgb&dpr=1&w=500" alt="" srcset="">

      <h1 class="heading-team">Our Team</h1>
      <div class="team-members">
        <h1 class="member-name">Lara</h1>
      </div>

And when I inspect on our team it shows an image( This is the inspected image ).当我检查我们的团队时,它会显示一个图像(这是检查过的图像)。 Thank you,谢谢,

Maybe try and move the margin or padding to a -25px也许尝试将边距或填充移动到 -25px

in your example, you didn't close the first div.our-team tag Maybe that's the reason?在您的示例中,您没有关闭第一个div.our-team标签也许这就是原因? BTW, if I understood you correctly, maybe this one help you?顺便说一句,如果我理解正确的话,也许这个对你有帮助? https://jsfiddle.net/Madebyspeedster/fq0emnk1/14/ https://jsfiddle.net/Madebyspeedster/fq0emnk1/14/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM