gpt4 book ai didi

html - 我无法在 css 中自定义图片的大小。

转载 作者:太空宇宙 更新时间:2023-11-04 12:13:42 26 4
gpt4 key购买 nike

我试图使图片 100%,但它不起作用。

代码:

html:

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top">Start Bootstrap</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-right">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>

<!-- Intro Section -->
<div class="headerimg"
><img src="pix/stockvault-city-skyline-at-sunset-113039.jpg">
</div>
<section id="intro" class="intro-section">
<div class="container">
<a href="#about" class="page-scroll btn btn-xl">Tell Me More</a>
</div>
</section>

CSS:

.headerimg {
width: 50%;
height: 100px; }

如果有人能提供帮助,那将非常有帮助。我通常能够做到,但由于某种原因我这次无法做到。再次感谢你的帮助。

最佳答案

只需将 CSS 更改为:

    .headerimg
{
width: 50%;
height: 100px;
}

img {
width: 100%;
}

它将使图像的宽度 100%

看这个:http://jsfiddle.net/cadh3vv9/

关于html - 我无法在 css 中自定义图片的大小。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28869876/

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