如何将我的背景图像扩展到整个屏幕
how to stretch my background image to whole screen?
我尝试了几种不同的方法,但不幸的是,我找不到解决方案这是我页面的外观https://i.stack.imgur.com/xCAxY.png
这是我的CSS
.first{
padding-top:0px;
padding-bottom: 0px;
background: url('../image/background.jpg');
background-attachment:fixed;
background-repeat:no-repeat;
background-size:100% 100%;
background-position: center;
position: absolute;
}
这是代码
<div class="first">
<div class="jumbotron" style="margin-left:0px;">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-lg-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
<div class="col-lg-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
</div>
<div class="col-lg-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p>
</div>
</div>
</div>
您几乎没有提供任何进一步的信息。如果CSS应用在body上,请确保html和body上的最小高度为100%,也许您正在寻找背景大小:cover属性。
width: 100vh
height: 100vh
或
background-size: cover
相关文章:
- javascript函数将数据添加到屏幕,但随后被另一个函数覆盖
- 带有嵌入脚本的SVG可扩展到浏览器的可用空间
- 如何为事件计时并使用JavaScript将其输出到屏幕
- 当用户将鼠标移到屏幕/图表上时,自动滚动将暂停.如果鼠标移动停止,自动滚动将再次恢复
- Make:如果父元素溢出,after元素将扩展到全宽
- Element赢得'当我动态更改底部属性时,t锚定到屏幕底部
- 将文本框中的文本打印到屏幕上
- 迭代JSON对象并将元素打印到屏幕上的最佳方式是什么
- 当用户在HTML中点击回车键时,我如何将输入打印到屏幕上
- 用JavaScript制作一个按钮的动画,从按钮到屏幕中心弹出一个模式对话框
- 无限滚动可在快速滚动时跳转到屏幕顶部
- JQuery将事件扩展到给定类的新对象
- 为什么它要将包含的文件中的所有注释打印到屏幕上
- JQuery Animate 函数在制作动画之前跳到屏幕顶部
- CSS3 过渡:将固定页脚或固定页眉扩展到最大大小,而不叠加页眉或页脚
- 表不会扩展到 100%
- 在 Ajax 将内容扩展到屏幕之外之后,如何找到页面高度
- 在页面显示到屏幕之前删除DOM元素(在Chrome扩展中)
- 将屏幕一侧的元素扩展到屏幕底部
- 如何将我的背景图像扩展到整个屏幕