html - 如何让我的 "jumbotron"响应?

标签 html css

.jumbotron{
  width:100%;
  height:50vh;
  background: url('longboard.jpeg');
  color:white;
}

我正在尝试从头开始构建一个“jumbotron”。目前,它的 html 只是一个什么都没有的东西。截至目前,图片只是在右侧切断,而我的导航栏向下缩放。我希望背景图片也随之缩小。我该怎么做?

此外,每当我向 div 添加一个或任何东西时,我的导航栏上方都会出现一个边距,我没有连接它。如果我违反了任何发帖礼仪,请提前道歉,这是我在这里的第一篇帖子。

最佳答案

也许试试这个:

.jumbotron {
    background: url('longboard.jpeg') no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    height: 50vh;
    width: 100%;
    overflow: hidden;
    color: white;
}

资源 - https://css-tricks.com/perfect-full-page-background-image/

关于html - 如何让我的 "jumbotron"响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50244153/

相关文章:

css - CSS 是否接受带空格的文件夹名称?

html - 如何测试 CSS/HTML/jQuery?

html - 当我调整浏览器大小时,css 容器没有调整

php - 是否可以将 PHP 与 HTML "Value"属性一起使用

javascript - TypeError : $(. ..).dialog 不是 devserver 上的函数

html - 背景图像顶部隐藏在浏览器书签栏下

css - 我使用悬停的 css 工具提示在 IE8 上不起作用

html - 父 DIV 未扩展以适应所有内容

javascript - 当 parent 溢出时触发 child 溢出

jquery - 如何在悬停时更改箭头的颜色?