Menu bar placed atop a carousel

I am currently in the process of developing a website and I have encountered an issue with the navigation bar. I have a slider that I would like to appear below the navbar but the navbar is pushing it down instead. Ideally, I want the navbar to be transparent so that it doesn't obstruct the slider images behind it.

To achieve my desired look, I am using Bootstrap and making some style adjustments.

Below is the HTML and CSS code, can you advise on what modifications or additions need to be made?

$(document).ready(function() {
  $('.intro-slider').slick {
    dots: false,
    arrows: false,
    autoplay: true,
    autoplaySpeed: 2000,
    infinite: true,
    slidesToShow: 1,
    adaptiveHeight: false
  });
});
.intro-slider {
  width: 100%;
  height: 1080px;
  overflow: hidden;
  padding: 0;
}

.navbar-default,
.container-fluid,
.navbar-default .navbar-collapse,
.navbar-default .navbar-form,
.navbar-collapse.collapse,
.navbar navbar-default {
  background-color: #000;
}

.navbar {
  position: relative;
  min-height: 50px;
  margin-bottom: 0px;
  border: 0px;
}

hr {
  margin-top: 0px;
  margin-bottom: 0px;
  border: 0;
  border-top: 1px solid #2f2f2f;
}

img {
  max-width: 600px;
  height: auto;
}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Montserrat:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick.min.js"></script>
<link href="http://kenwheeler.github.io/slick/slick/slick.css" rel="stylesheet"/>

<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="css/stylesheet.css">


<body>
  <div style="" class="collapse navbar-collapse">
    <ul class="nav navbar-nav navbar-right">
      <li class="navfont2">
        <p><i class="fa fa-phone-square" aria-hidden="true"></i> +1 809 974 7826</p>
      </li>
      <li class="navfont2">
        <p><i class="fa fa-envelope" aria-hidden="true"></i> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e18e938492958492a18c888f95848289cf858e">[email protected]</a></p>
      </li>
    </ul>
  </div>
  <hr>
  <!-- navbar start -->
  <nav class="navbar navbar-default">
    <div style="" class="container-fluid">
      <!-- Brand and toggle get grouped for better mobile display -->
      <div style="" class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
          <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" href="#"><img style="width: 175px;" src="images/mintech.png"></a>
      </div>

      <!-- Collect the nav links, forms, and other content for toggling -->
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <ul class="nav navbar-nav navbar-right">
          <li class="navfont"><a href="#">Inicio</a></li>
          <li class="navfont"><a href="#">Nosotros</a></li>
          <li class="navfont"><a href="#">Servicios</a></li>
          <li class="navfont"><a href="#">Proyectos</a></li>
          <li class="navfont"><a href="#">Equipo</a></li>
          <li class="navfont"><a href="#">Contacto</a></li>
        </ul>
      </div>
      <!-- /.navbar-collapse -->
    </div>
    <!-- /.container-fluid -->
  </nav>
  <!-- navbar end -->
  <div class="intro-slider col-xs-12">
    <div><img src="https://www.almanac.com/sites/default/files/birth_month_flowers-primary-1920x1280px_pixabay.jpg"></div>
    <div><img src="http://balconygardenweb.com/wp-content/uploads/2015/08/most-poisonous-flowers-3_mini.jpg"></div>
    <div><img src="http://data.whicdn.com/images/57613434/large.jpg"></div>
  </div>

Answer №1

If you want to place your navbar above the slider, it is possible to do so by using absolute positioning. I also needed to add relative positioning to adjust the position of the slider as well. All of my code has detailed comments to make it easier for you to understand. Additionally, I made the navbar transparent for a sleek look.

$(document).ready(function() {
  $('.intro-slider').slick {
    dots: false,
    arrows: false,
    autoplay: true,
    autoplaySpeed: 2000,
    infinite: true,
    slidesToShow: 1,
    adaptiveHeight: false
  });
});
.intro-slider {
  width: 100%;
  height: 1080px;
  overflow: hidden;
  padding: 0;
}

.navbar-default,
.container-fluid,
.navbar-default .navbar-collapse,
.navbar-default .navbar-form,
.navbar-collapse.collapse,
.navbar navbar-default {
  background-color: #000;
}

.navbar {
  position: relative;
  min-height: 50px;
  margin-bottom: 0px;
  border: 0px;
}

hr {
  margin-top: 0px;
  margin-bottom: 0px;
  border: 0;
  border-top: 1px solid #2f2f2f;
}

img {
  max-width: 600px;
  height: auto;
}


/* \\\\\\\\\\\\\\\\\\\\\\\\ new styles below ///////////////////////////// */
hr {
  display: none; /* margins on hr were pushing gallery down */
}
body .navbar { /* place navbar atop slider */
  width: 100%;
  opacity: 0.75;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
}
.intro-slider { /* move slider up */
  position: relative;
  top: -3rem;
}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Montserrat:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick.min.js"></script>
<link href="http://kenwheeler.github.io/slick/slick/slick.css" rel="stylesheet" />

<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/stylesheet.css">


<body>
  <div style="" class="collapse navbar-collapse">
    <ul class="nav navbar-nav navbar-right"> 
      <li class="navfont2">
        <p><i class="fa fa-phone-square" aria-hidden="true"></i> +1 809 974 7826</p>  
     </li> 
      <li class="navfont2">  
        <p><i class="fa fa-envelope" aria-hidden="true"></i> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="305f425543445543705d595e445553581e545f">[email protected]</a></p>   
     </li>  
   </ul>    
</div>   
  <hr>    
  <!-- Navbar Start -->
  <nav class="navbar navbar-default">
    <div style="" class="container-fluid">
      <!-- Brand and toggle get grouped for better mobile display -->   
     <div style="" class="navbar-header">
       <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">         
  <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" href="#"><img style="width: 175px;" src="images/mintech.png"></a>
      </div> 

      <!-- Collect the nav links, forms, and other content for toggling -->  
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">           
  <ul class="nav navbar-nav navbar-right">             
 <li class="navfont"><a href="#">Inicio</a></li>                 
 <li class="navfont"><a href="#">Nosotros</a></li>                  
<li class="navfont"><a href="#">Servicios</a></li> 
             <li class="navfont"><a href="#">Proyectos</a></li>       
          <li class="navfont"><a href="#">Equipo</a></li>        
              <li class="navfont"><a href="#">Contacto</a></li>            
     </ul>      
  </div>       
 <!-- /.navbar-collapse -->     
 </div>  
    <!-- /.container-fluid --> 
  </nav> 
  <!-- Navbar End -->
  <div class="intro-slider col-xs-12"> 
    <div><img src="https://www.almanac.com/sites/default/files/birth_month_flowers-primary-1920x1280px_pixabay.jpg"></div>     
   <div><img src="http://balconygardenweb.com/wp-content/uploads/2015/08/most-poisonous-flowers-3_mini.jpg"></div>  
   <div><img src="http://data.whicdn.com/images/57613434/large.jpg"></div>
  </div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Angular4: Customizing Ng-Bootstrap Datepicker to Highlight Certain Days

I am struggling to figure out how to highlight matching dates in a datepicker for an array of tasks that each contain a date. Can anyone provide guidance on how to achieve this? Here is the TypeScript code snippet I have been working with: import { Compo ...

A demonstration of VueJS Nested Builder functionality

I am currently exploring VueJS and working on a project to create a simple page builder application that allows users to add sections and subsections. I am seeking guidance on how to properly set up the Vue data property for this functionality. Any advice ...

A step-by-step guide on making an animation series with html and css keyframes

I've been working on creating a captivating animation using HTML and CSS keyframes, but I seem to have hit a roadblock. Despite trying different rotations and transforms, I can't seem to achieve the desired effect depicted in the image below. The ...

Embedded Twitter posts are not showing up correctly when using vue

My backend is Django and frontend is Vue. In one of my models, I have a rich text editor. When saving the content, it converts tweet links to embedded HTML tweets. While displaying this content in a div with v-html binding in Vue, everything appears as exp ...

Using Javascript, dynamically animate the text in the hero unit with fading in and out effects

I currently have a "Hero" unit with the following code: <div class="hero-unit"> <div class="container"> <h1>Dapibus Euismod Mollis</h1> <p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis ...

Discover the ultimate guide to implement a captivating visual overlay using CSS

I've crafted some links using CSS to incorporate a background image (to give it the appearance of a button) employing the subsequent code: <a class="btnImg" id="btnImgConfig" href="#"></a> .btnImg { width:100px; height:100px; ...

When a HTML file is piped or streamed into a browser, it is displayed as plaintext

I'm currently working with an Express handler router.get('/', ac.allow('Admin'), function (req, res, next) { let html = path.resolve(__dirname + '/../coverage/lcov-report/index.html'); fs.createReadStream(html).pip ...

Showing JSON data on a webpage

Hey there, I'm looking to showcase information from a MySQL table in an HTML document. Currently, I have a PHP script that is up and running: <html> <head> </head> <body> <?php $mysqli = new mysq ...

The vertical alignment feature seems to be malfunctioning in Bootstrap 4

My goal is to center multiple images within their respective divs, but I am facing issues with vertical alignment not working as intended. Even the CSS classes d-flex justify-content-end and text-center are failing to align the icons side by side. I need t ...

Replace the pixel measurements with percentage values

I have a vision for creating a dynamic full-width slider using a flex-wrapper and multiple child sections. Each section spans the width of the viewport and is aligned in a row. The goal is to move the flex-wrapper by 100% margin-left every time a button ...

Validate and submit form using mootools when a link is clicked

Is there a way to validate my form and submit it when a link is clicked? I have included my code below: new Element('a',{ 'html': "To cart", 'class': 'shop ...

Auto Height Background Colour in Dual Columns

There seems to be a simple issue that I'm missing here. I have two columns that maintain the same height based on the content inside them, but the background color doesn't fully extend in the shorter column. When the display shrinks, the columns ...

How can I fix the issue where Sx is not converting the styles to CSS format for the fill property exclusively?

The primary-main is supposed to change color to something like #abcdefg, but it seems to be stuck displaying primary-main as is. I am working with angular MUI + React ...

Tips for inserting a value into an HTML field using ASP.NET code behind

Recently, I created an application in JavaScript by utilizing HTML fields in ASP.NET. Due to some issues with the IDs, I had to resort to using HTML fields instead of ASP text boxes. Surprisingly, the HTML fields are functioning well with JavaScript. Now ...

Incorrect placement of navigation in HTML/CSS dimensions

I'm working on my new portfolio and I've run into an issue with the navigation placement that I can't seem to solve. The text should be aligned with the lines on the sides, but instead it's shifted right and down. I'm struggling t ...

Tips for automatically adjusting the height of the footer

Is there a way to dynamically adjust the height of the footer based on the content length inside the body? I've been exploring solutions like setting the position of the footer as "fixed," but it seems to stay at the bottom of the screen, which is no ...

Responsive menu is failing to respond to the click event

I'm facing an issue with my responsive menu on mobile phones. It should display two buttons - one for the navigation bar and the other to toggle the side bar by removing the classes hidden-xs and hidden-sm. However, I am having trouble getting the btn ...

Customize CSS for Vimeo's HTML5 player

Can I customize Vimeo's HTML and CSS attributes? I have a video that autoplays and I don't want the play button. I want to modify this specific class. .a.l .b .as { position: absolute; top: 50%; left: 50%; margin: -2em 0 0 -3.25em; float: none; ...

What are the steps to showcase a multiplication chart based on user-inputted rows and columns using jQuery?

I'm currently facing some challenges with coding a multiplication table using jQuery. I already have the code to display the multiplication table based on inputted rows, but I need help in modifying it to allow for inputting both rows and columns. An ...

Is it possible to alter the background color once the content of an input field has been modified?

I am working with an angular reactive form and I want to dynamically change the background color of all input fields when their value is changed. Some of these input fields are pre-populated and not required. I came across a potential solution on Stack Ove ...