简体   繁体   English

如何将图像定位在固定响应式引导程序图像上

[英]How To Position An Image Over Fixed Responsive Bootstrap Image

So I'm building a simple bootstrap site (the top so far): 因此,我正在构建一个简单的引导站点(迄今为止最热门):

没有花哨的顶部边框

and I'm trying to get this effect in the top background image: 我试图在顶部背景图片中获得这种效果:

带有精美的顶部边框

As you can see the second image has a slightly transparent png image lodged on top of the navigation. 如您所见,第二个图像在导航顶部有一个稍微透明的png图像。 How would I get something like this to be fixed and responsive? 我将如何解决这样的问题并做出响应? I'm having trouble with absolute positioning and such. 我在绝对定位等方面遇到麻烦。 Thanks for any insihgt! 感谢您的任何帮助!

Edit: I haven't even gotten the second image to work out in the css, that was simply an edit in Photoshop. 编辑:我什至没有得到第二张图片在CSS中完成,这只是在Photoshop中进行的编辑。

Relevant HTML 相关HTML

<!-- Top Background image above Nav -->

<div class="container-fluid parallax-1" id="Title">
    <div class="container-fluid parallax-inner">

        <div class="row">
            <div class="col-sm-12 col-lg-12 text-center">
                <h1 class="fade1"> Italian Joe's </h1>
            </div>

          </div>
        </div>
    </div>
</div>


  <!-- End Title Parallax -->

  <!-- Start Navbar -->

  <nav class="navbar navbar-inverse">
    <div class="container-fluid">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#">Italian Joe's</a>
        <p class="navbar-text text-center" id="NavHours" style="color:white; width: 230px;"> Open 6am to 5pm </p>
      </div>

      <div class="collapse navbar-collapse" id="myNavbar">

        <ul class="nav navbar-nav navbar-right">
          <li id="Home" class="active"><a href="#">Home</a></li>
          <li><a href="#">Menu</a></li>
          <li><a href="#">About</a></li>
          <li id="location"><a href="#">Location</a></li>
        </ul>
      </div>
    </div>
  </nav>

  <!-- End Navbar -->

Relevant CSS 相关CSS

/* --- Navbar --- */

.fade1{

    font-family: 'Jim Nightshade', cursive;
    font-size: 8.9em;
    font-style: italic;
}

.navbar {
    margin-bottom: 0px;
    border-radius: 0px;
    background-color:black;
}

.nav.navbar-nav.navbar-right li a {
    color: white;
}


.navbar-inverse .navbar-brand {
    color: white;
}

/* Hover */

.navbar-inverse .navbar-nav>.active>a, .navbar-inverse .navbar-nav>.active>a:focus, .navbar-inverse .navbar-nav>.active>a:hover {
    background-color: black;
}


/*-- Stubborn Home Element -- */

.navbar.navbar-inverse .navbar-nav>li {
      border-bottom: solid 1px;
      border-color: white;
      text-align: center;
    }

#Home {
       border-top: solid 1px;
      border-color: white;
      text-align: center;

}



.navbar .navbar-collapse {
  text-align: center;
  padding: 0px;
}

/* --- End Navbar --- */


/* --- Title Parallax --- */

#Title {
    padding-top: 5%;
    color:white;
}

/* --- End Title Parallax --- */

/*----Start Parallax Sections----*/


.parallax-1 {
    background: url("../img/pizzatitle.jpg") fixed 100%;
    background-size: cover;
    background-repeat: no-repeat;
   }

.black_brush {
    top: 40%;
    width: 100%;
    height: 200px;
    background: url("../img/blackbrush.jpg");
    position: relative;
    z-index: 1;
}


.row {

    margin: 0px;
}

.parallax-inner {
    padding-bottom: 5%;

}

.clearfix{

    clear: both;

}

.parallax-inner h3, .parallax-inner p {
    color: #F1F1F1;

}

/*----End Parallax Sections----*/

ALL Code 所有代码

https://codepen.io/Sovember/pen/OpwXKe https://codepen.io/Sovember/pen/OpwXKe

Use bootstrap navigation bar if you want it to be fixed on the top. 如果要将引导栏固定在顶部,请使用引导栏。 I don't understand exactly what you mean with the transparency of the image. 我不完全了解您对图像透明度的含义。 If you want it removed, then use this: 如果要删除它,请使用以下命令:

opacity: 1;

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

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