gpt4 book ai didi

html - 当尺寸较小时从标题中删除填充

转载 作者:太空宇宙 更新时间:2023-11-04 09:39:41 25 4
gpt4 key购买 nike

我正在让网站从导航栏固定顶部开始然后 slider 有 h1 和 p 标签没有图像所以我给幻灯片类命名为 .item 并给这个类 padding:400px 0;给我一个漂亮的大标题,我在大屏幕上为整个 slider 使用背景图像属性,一切正常,但在较小的屏幕上,我在 h1 和导航栏之间以及 h1 和轮播指示器之间有很大的空间搜索并尝试删除 @media(max-width:750px) 和 @media(max-width:480px) 上的填充和边距,但它没有用,所以我怎么能失去这个填充?

@media (max-width:750px){

#slider .container #mycarousel .carousel-inner .item{
padding:0;
margin:0;
}

}

@media (max-width: 480px){
#slider .container #mycarousel .carousel-inner .item{
padding:0;
margin:0;

}



}

/* Slider */
#slide{

background-image: url(../img/header.jpg);
background-repeat: no-repeat;
background-size: contain;
background-position: center;

}
.item{

color:#fff;
padding:400px 0;
}
 <section id="slide" class="text-center">
<div class="container">
<div id="mycarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#mycarousel" data-slide-to="0" class="active"></li>
<li data-target="#mycarousel" data-slide-to="1"></li>
<li data-target="#mycarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">

<h1>Let's Make Business Look Better</h1>
<p>And The Shape Of Work Is Only The Stylish Shape</p>
<button type="button" class="btn btn-success">I Smell Success</button>

</div>
<div class="item">

<h1>Let's Make Business Look Better</h1>
<p>And The Shape Of Work Is Stylish</p>
<button type="button" class="btn btn-success">Take Me There</button>

</div>
<div class="item">

<h1>Let's Make Business Look Better</h1>
<p>And The Shape Of Work Is Stylish</p>
<button type="button" class="btn btn-success">Let's Do It</button>

</div>



</div>


</div>


</div>



</section>

最佳答案

你打错了,它应该是 #slide 而不是 #slider,因此永远不会定位 .item 元素。

@media (max-width:750px) {
// this should be #slide, not #slider
#slide .container #mycarousel .carousel-inner .item {
padding:0;
margin:0;
}
}

@media (max-width: 480px) {
// this should be #slide, not #slider
#slide .container #mycarousel .carousel-inner .item {
padding:0;
margin:0;
}
}

希望这对您有所帮助。

关于html - 当尺寸较小时从标题中删除填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40031921/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com