Creating a sleek and modern design using Bootstrap 3 that maximizes both width and height, featuring a 3

I've hit a roadblock with this basic webpage (I know it's not the most exciting project, but bear with me). I've been using Bootstrap for years, but now my manager wants it to be mobile-friendly. No matter what I try, I can't seem to get the layout right, especially with a Navbar in the middle like the screenshot below. The width is fine, but setting the height correctly is proving to be a challenge.

https://i.sstatic.net/Mi6Cl.png

On desktop, I attempted a three-column layout that looked alright until I added the middle navbar (it ended up looking bloated and out of place in the background). Moreover, none of the columns are adjusting their heights correctly, so I suspect there might be an issue with the CSS. I experimented with height:auto and height:fixed, but neither provided a perfect solution as shown in the snippet of code below.

https://i.sstatic.net/N3hEB.png

<div class="container">
<div class="row">
    <div class="col-sm-5"></div>
    <div class="col-sm-2"></div>
    <div class="col-sm-5"></div>
</div>

Although I'm using 'col' for layout, I have a feeling I'll be told to switch to flexbox soon.

To add to the complexity, most templates or examples I find only use one image for a full-width background. Dealing with multiple images within the column height is proving to be quite challenging.

    .MainBackgroundImages {
        padding-bottom: 40%; 
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-size: cover;
}

Below is a code snippet where you can see the height issue:

.leftHalf {
  background-image: url('https://via.placeholder.com/2000/FF0000/FFFFFF/?text=Left');
}

.centerHalf {
  background-color: black;
  color: white;
  text-align: center
}

.rightHalf {
  background-image: url('https://via.placeholder.com/2000/FFFF00/00000/?text=right');
}

.MainBackgroundImages {
  padding-bottom: 40%;
  background-position: 50% 50%;
  background-repeat: no-repeat;
  background-size: cover;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>


<div style="”clear: both;"></div>
<div class="row">
  <div class="col-sm-5 MainBackgroundImages leftHalf"></div>
  <div class="col-sm-2 centerHalf">
    <br>
    <div class="navbar navbar-default" id="custom-bootstrap-menu" role="navigation">
      <div class="container-fluid">
        <div class="navbar-header">
          <a class="navbar-brand" href="#">Ishka Sport</a> <button class="navbar-toggle" data-target=".navbar-menubuilder" data-toggle="collapse" type="button"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
        </div>
        <div class="collapse navbar-collapse navbar-menubuilder">
          <ul class="nav navbar-nav navbar-left">
            <li>
              <a href="/">Home</a>
            </li>
            <li>
              <a href="/products">kayak</a>
            </li>
            <li>
              <a href="/about-us">Nipper Boards</a>
            </li>
            <li>
              <a href="/contact">Accessories</a>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
  <div class="col-sm-5 MainBackgroundImages rightHalf">
    <div class="col-md-12 text-center"></div>
  </div>
</div>

Answer №1

To achieve a full height layout, specify the parent element of the columns to take up the entire available height of the viewport using the following class definition:

.full-height {
  height: 100vh;
}

Apply this class to the row wrapping the columns. Then, set the height property of the three columns to 100% so they utilize the full height of the parent element.

For smaller devices (SM), adjust the layout by making all columns span the 12 grids provided by Bootstrap. Use a media query like the one below to manage column heights at breakpoints (Bootstrap 3 breakpoints reference: Bootstrap 3 Media Queries):

@media only screen and (max-width : 992px) {

    .leftHalf {
        height: 40%;
    }

    .centerHalf {
        height: 20%;
    }

    .rightHalf {
        height: 40%;
    }
}

Check out the working example below to see how this layout behaves in fullscreen mode and when resizing the browser. See if you can spot any issues with the display of the middle navbar. It should serve as a helpful foundation for the layout you require.

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

What are some ways to enhance the appearance of the initial two items in a list through CSS?

Is it possible to enhance the appearance of the first 2 elements in a list using CSS for IE8 compatibility? Here is an example of the format: <ul id="list1" style="margin-left:-20%;font-weight:bold" > <li class="xyz"> Element1 </li> ...

Show data in a popup using jQuery DataTables and loading content asynchronously via Ajax

I am attempting to display a list in a popup based on an Ajax request. Prior to the Ajax call, the list is contained within the popup. However, after the Ajax request, the list remains on the page instead of inside the popup, and the old list still appears ...

Tips for accessing information from a FOR loop within DIV tags

Let's explore the following code snippet: Here is the HTML generated: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Website ...

Incorporate smooth transitioning effects with CSS onto the image carousel

My challenge involves creating a slider with 3 images and corresponding buttons that change the current image when clicked. I now seek to enhance this functionality by incorporating smooth transitions using CSS. I envision a scenario where clicking on any ...

Modifying Input Types Using Javascript Within an HTML Table

I've managed to write some code that lets a user add rows to a table by clicking a button. Input fields are inserted into these rows. Now I'm wondering how I can set it up so that the first column has an input type of "text", while the middle col ...

If other options fail, Else If may not be a suitable choice

This is the process: switching from Issue: x==0||1 to x==0||x==1 etc. This code runs from an .html file <body> <div class="" id="pimg1"> </body><script> var x=new Date().getMonth(); if (x == 0||x == 5||x == 2){docu ...

Unveiling the Secrets of Implementing Interactive HTML Tabs

I have a simple HTML page that contains a table with two columns and two rows. My goal is to convert these two columns into tabs, so that when each row is clicked, it will display either a paragraph or another basic table with one row and column. All of t ...

Customize the appearance of the 'Update' or 'Publish' WordPress button using code from functions.php or style.css

Current issues with permissions to core files and stylesheets are prompting me to seek ways to customize the LOCATION and APPEARANCE of the 'Update / Publish' button in Wordpress CMS posts/pages. Any tips on how to achieve this despite the challe ...

What is the best way to adjust my column position in order to make the links clickable?

Looking for help with a mobile version website menu bar design. The issue is that the central "+" button is covering the two icons on either side, making them unclickable. Is there a solution to rearrange this layout? Here is the current design: https:// ...

Unexpected rendering occurs when using a CSS double transition

In my React application, I am working on implementing smooth page transitions for a more visually appealing user experience. While using simple fade-in/fade-out transitions, I have noticed that transitions between pages with similar content are not as smoo ...

Design a basic button that does not adopt any of the CSS attributes from Bootstrap

Currently, my styling is done using Bootstrap.css. However, I am interested in creating a straightforward <button> without incorporating any of the CSS properties from Bootstrap. Specifically for this <button>, I do not want it to inherit any ...

Display a div in front of another using Material UI when hovering

Is there a way to display a black transparent div in front of a <MediaCard/> when hovering over it? Below is the code snippet I am using with Material UI: <Box> <Typography variant='h3'>Home Page</Typography> < ...

Place the vertically centered div with a height that exceeds the viewport's height

I have been trying to find a solution to my question, but I can't seem to locate any answers. I have a webpage with a main div that contains all the content. I centered it using the following CSS: .center { position: relative; top: 50%; transfo ...

Is there a way to use the same background image for both the left and right borders?

How can I set this image as both the left and right background image on my webpage? I want it to be displayed on both sides. Any suggestions on how to achieve this? Here is the code snippet I have implemented so far: <%@ Page Language="C#" AutoEventW ...

Having trouble with compiling SCSS code

While diving into the world of SCSS, I decided to compile my SCSS into CSS using npm. So I entered npm run compile: sass as defined in my package.json as follows: "scripts": { "compile:sass": "node-sass sass/main.scss css/style ...

Currently, my goal is to create a functional copy button through the use of JavaScript

I've been attempting to create a basic copy button using JavaScript, but I keep encountering an error. TypeError: null is not an object (evaluating 'myInp.select') Whenever I click the copy button, My code looks like this: <!DOCTYPE htm ...

The screen reader seems to be malfunctioning as soon as I include this particular code

//Finding the height of the header let headerHeight = document.querySelector('header'); let height = headerHeight.offsetHeight; //Adjusting the #navbarNav's top margin to accommodate the header let nn = docu ...

Issues with HTML marquee not functioning properly post fadeIn()

I am attempting to create a progress bar using the HTML marquee element. When the user clicks submit, I want to fadeIn the HTML marquee and fadeOut with AJAX success. However, when I click the submit button, the marquee does not fadeIn as expected. Here is ...

Try incorporating the <code> tags or a similar method in ReactJS when using JSX

I've been experimenting with ReactJS and JSX to develop a prototype for a styleguide. One issue I encountered is that JSX seems to be ignoring my <code> tags, instead of displaying the raw HTML code needed to call components. Here's what ...

Concealing a hyperlink within a DIV by removing or hiding it

I am looking to temporarily hide or remove a specific link (team.aspx) within a drop-down menu, with the intention of adding it back in later. Here is my current code: <div id="nav_menu"> <ul id="nav"> <li class="current"><a href= ...