"Building a Dynamic Website: Utilizing Twitter Bootstrap for a 3 Column Layout with

I am currently exploring ways to create a simple layout using Twitter bootstrap 3.

The layout consists of a sticky header (always at the top of the viewport), a footer positioned at the bottom of the content (not fixed to the bottom of the viewport), and in between, there are 3 columns. The left and right columns have fixed widths of 200px each while the middle column's width is fluid depending on the screen size.

I've experimented with several methods to achieve this layout but I'm feeling a bit overwhelmed now. Can someone provide guidance on how to accomplish this?

EDIT 1(5): This is my current header-footer layout code. Despite my efforts, I haven't been successful in creating the three columns yet. Making another attempt now. Currently facing issues where a) the columns are fluid and b) the 12-column layout aligns to the left without occupying the entire width.


    <div class="container-full">      
        <div class="navbar navbar-static-top">  
            <div class="navbar-inner blue-bg">
                <a href="#" class="brand"><img src="images/kab/logo-header.png" alt="KAB Logo Large"/></a>
            </div>
        </div>  

        <div class="container-full">    
            <div class="row-fluid">

                <div class="span1">
                    <h4>Left Column</h4>
                </div>

                <div class="span10">
                    <h4>Center Content</h4>
                </div>

                <div class="span1">
                    <h4>Right Column</h4>
                </div>
            </div>

        </div>

        <div class="navbar navbar-fixed-bottom">
            <div class="navbar-inner blue-bg" style="height: 77px;"> </div>
        </div>
    </div>

EDIT 2: Made an unsuccessful attempt using DIV elements. Does this approach defeat the purpose of utilizing a framework?

EDIT 3: Desired structure of the layout:

    
    +------------------------------------------------------+
    |                       Header                         |
    +------------+------------------------------+----------+
    |            |                              |          |
    |            |                              |          |
    |  Fixed     |       Fluid Column           |  Fixed   |
    |  200px     |                              |  200px   |
    |            |                              |          |
    |            |                              |          |
    |            |                              |          |
    |            |                              |          |
    |            |                              |          |
    +------------+------------------------------+----------+
    |                        Footer                        |
    +------------------------------------------------------+

EDIT 4: Found a fiddle that somewhat meets the requirements but has some whitespace on the right side. Is this the most effective way to implement such a layout?

http://jsfiddle.net/FzVtx/123/

Answer №1

For those who are still using BS3 and are looking to achieve this specific design, here is the solution:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>

<style>
/* 
This is for a 200px width.
It is commented out because it may cause layout issues on small screens with multiple nested divs.
.col-xs-2 {min-width: 200px;}
*/
</style>
<div class="container-fluid text-center">
  <nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">Header</div>
  </nav>
  <div class="row" style="margin-top: 50px;">  
    <div class="col-xs-2">
      <h4>Left Column</h4>
    </div>
    <div class="col-xs-8">
      <h4>Center Content</h4>
    </div>
    <div class="col-xs-2">
      <h4>Right Column</h4>
    </div>
  </div>
  <div class="col-12">
    <div class="container">Footer</div>
  </div>
</div>

Answer №2

I am not familiar with using Bootstrap for this task, but here is a traditional method to achieve the desired outcome.

Start by creating a header that spans the full width of the page. Next, set up three separate divs. The left div should have a width of 200px and be floated to the left, while the right div should also have a width of 200px and be floated to the right. Both should have display:block properties. The middle div should have display:inline-block; Finally, create a footer that spans the full width of the page.

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

Encountering a NaN result while attempting to incorporate a drop-down menu into a newly developed macro calculator

Before the calculator was functioning smoothly, but as soon as I included the activity level selection from the dropdown menu, things took a turn. The expected output is supposed to be the result of multiplying the user's chosen activity level by the ...

The Main page is being graced by a floating Twitter Bootstrap video

When trying to display a video next to a paragraph, I encountered an issue where the paragraph was taking up 100% of the screen and the video was floating over it, obstructing part of the text. Despite setting the row and cols, the layout wasn't behav ...

monitoring the HTML code post-editing

After using jQuery, I made modifications to the HTML source code by adding several text fields. However, when I check the page source in Google Chrome, it still shows the original source code. Is there a method to view the updated HTML code? ...

Creating a simulated loading screen

I have created a preloader page for my website following tutorials, such as the one found here: https://codepen.io/bommell/pen/OPaMmj. However, I am facing a challenge in making this preloader appear fake without using heavy content like images or videos. ...

Creating the Modal Window Effect using CSS

My goal is to create a modal window using CSS. I am working on adding a stylish element for users who have JavaScript disabled, which will be displayed using the noscript tag. Here is what I currently have: <div id="ns-overlay"> <section ...

Use a query and selection function on a table to identify the timestamp for various columns, and then transmit the data in JSON format

I have a list of strings in a table that indicate whether an LED is ON or OFF. I have also included timestamps to track when the LED was turned on. See my table below. https://i.sstatic.net/zYGPI.png Using the code snippet below, I was able to detect whe ...

CSS Horizontal Menu positioned left losing its background color due to float property

Can you explain why the background color of the ul element disappears when its child elements are floated? I have a vague memory of reading something about floats causing this issue, but I can't recall the details. (JSFiddle) ul { padding-left: ...

The search bar is visible on desktop screens and can be expanded on mobile devices

Check out my code snippet below. <style> #searchformfix { width: 50%; border-right: 1px solid #E5E5E5; border-left: 1px solid #E5E5E5; position: relative; background: #fff; height: 40px; display: inline-block; border: ...

What is the best way to retrieve an <a> tag element using Selenium in Python?

I am fairly new to using Selenium and could use some guidance with the following issue. I am attempting to create a birthday bot for Facebook, but navigating through the platform's latest UI has been challenging with JavaScript disabled. I've bee ...

Is there a way to automate testing for my web application bundled with webpack against FUOC?

After creating a React + Redux web app bundled with webpack, I encountered a bundling error that caused my website to display flash of unstyled content (FUOC) behavior. Certain components did not inject their CSS into the server response, resulting in pa ...

Animating vector graphics from a circle to a line using SVG

Is it possible to convert a circle into a line (path)? I'm having trouble finding information on how to shape the svg element. Perhaps my search technique is the issue. <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg ...

How can I center an image next to text on two lines, that is compatible with IE7?

I am trying to align an image (logo) with text in two lines - the website title and a brief description. Here is my attempt using HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional ...

Real-time collaborative Whiteboard using WebSocket technology (socket.io)

I am currently working on developing a collaborative online whiteboard application using HTML5 canvas, Node.js, and Websockets (Socket.io). While my progress is going well, I am facing some challenges when it comes to drawing circles. I have been successfu ...

Modify the background color of paragraph using JavaScript based on the outcome

I am trying to update the background color of a search result in a paragraph tag based on a condition where the value of a variable is greater than 1. I believe this can be achieved using an if statement. Below is the code snippet I am currently working on ...

Is it possible to modify the default behavior of a sensitive region within a button?

I created a calculator application in React and overall, it's working fine, however... I've noticed that when I hold a click longer, it only registers as a click if the mouse was pressed down and released on the button itself. Although I unders ...

What is the best way to eliminate existing double quotation marks within string values stored in objects in Angular?

When using Angular, data is retrieved in object form from the database to the backend and then to the frontend. Here's how it looks in HTML: <h3>Payslip for the month of {{dataout[0].MonthYear | json }}</h3> The issue arises when running ...

Using both em and px units to add padding in CSS styling

Can padding be achieved using a combination of pixels and em units? For example, is it viable to apply padding-left with 2em plus 1px? Here's an illustration: padding-left: 2em + 1px; ...

Is it possible to set a single variable value for multiple attributes simultaneously in Javascript?

I would like to specify the horizontal padding of a styled element as variable 'x' and the vertical padding as variable 'y'. Here's one way to achieve this: var docex = document.getElementById.style; docex.paddingTop = y; docex.pa ...

Display a dialog box in jQuery UI 1.7 autocomplete when an item is selected

After implementing an autocomplete widget, I noticed that a dialog appears when an item is selected. However, I am struggling to get a specific field in the dialog to receive focus upon opening. Here is what I have attempted so far: //HTML <form actio ...

Setting up the nth-of-type() function to dynamically target elements in sequence

I need to apply specific CSS styles to elements in a certain order within an image carousel. The carousel may contain any number of images, but only three images are displayed at a time. I want to style the first and third images differently from the secon ...