CSS sidebars are failing to display on the website

Working on a supposedly simple template turned out to be more challenging than expected. The template lacked sidebars, so I attempted to add them myself. However, my test text isn't displaying as intended.

Could someone please help me identify the mistake I made?

You can view the problematic page at

Here is the code snippet:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>STFU Island</title>
<style type="text/css">

a.header:link {
color:#ffffff;
text-decoration:none;
hover {color:#ffcc00;}
}

body{
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
height: 100%; 
max-height: 100%; 
}

#framecontent{
position: absolute; 
top: 0; 
left: 0; 
width: 100%; 
height: 70px; /*Height of frame div*/
overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/
background-color: navy;
color: white;
}


#maincontent{    
position: fixed; 
top: 75px; /*Set top value to HeightOfFrameDiv*/
//left: 0;
//right: 0;
bottom: 0;
overflow: auto; 
background: #fff;
}

#leftbar {
float: left;
width: 30%;
}

#rightbar {
float: right;
width: 30%;
}
.innertube{
margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/
}

* html body{ /*IE6 hack*/
padding: 130px 0 0 0; /*Set value to (HeightOfFrameDiv 0 0 0)*/
}    

* html #maincontent{ /*IE6 hack*/
height: 100%; 
width: 100%; 
}

</style>


<link rel="stylesheet" href="style.css">
</head>

<body>
<div id="leftbar">
<div class="innertube">
<p>test</p>
</div></div>

<body>
<div id="rightbar">
<div class="innertube">
<p>test</p>
</div></div>

<div id="framecontent">
<div class="innertube">


<center><h3><font color="white"><a class="header" href="index.html">home</a> | <a href="islandstatus.html">Are You on an Island?</a> | <a href="about.html">About</a></font></h1></center>

</div>
</div>

<div id="maincontent">
<div class="innertube">
<center>
<form class="pure-form">
<fieldset class="pure-group">
    <input type="text" class="pure-input-1-2" placeholder="Your Name" name="creatorname" size="50">
    <input type="text" class="pure-input-1-2" placeholder="Your Email" name="creatoremail">
    <input type="email" class="pure-input-1-2" placeholder="Relationship to people being sent to island" name="relationship">
</fieldset>

<fieldset class="pure-group">
    <input type="text" class="pure-input-1-2" placeholder="Name of first person sent to STFU Island" name="person1">
    <input type="text" class="pure-input-1-2" placeholder="Their email address" name="email1">
</fieldset>


<fieldset class="pure-group">
    <input type="text" class="pure-input-1-2" placeholder="Name of second person sent to STFU Island" name="person2">
    <input type="text" class="pure-input-1-2" placeholder="Their email address" name="email2">
</fieldset>


<fieldset class="pure-group">
    <input type="text" class="pure-input-1-2" placeholder="Name of third person sent to STFU Island" name="person3">
    <input type="text" class="pure-input-1-2" placeholder="Their email address" name="email3">
</fieldset>

<fieldset class="pure-group">
    <input type="text" class="pure-input-1-2" placeholder="Tell them why they're being sent to STFU Island!" cols="40" rows="5" name="reason">
</fieldset>


<button type="submit" class="pure-button pure-input-1-2 pure-button-primary" name="submit">Send them to STFU Island!</button>
<br>aaaaEmail addresses are sacred and we will treat them that way. Email addresses collected are only used to send emails when people are added or are being set free from STFU island. No other company will ever see or use them for any reason. Period.
</form>

</center>


</div>
</div>


</body>
</html>

Answer №1

To enhance your CSS, include the following code for #leftbar and #rightbar:

z-index: 2;
position: relative;

This solution has been effective for me. Additionally, consider using color:#fff for better visibility. Instead of center, opt for text-align:center. Try utilizing a single div instead of nesting multiple divs within each other.

The original source code is cluttered and overwhelming for such a simple task. I will create a simplified version as a clone and provide an update soon.

Answer №2

It appears that your left side bar and right side bar are currently located below your title. To achieve the desired layout, consider placing them within the main content section and beside your inner tube. By moving the divs alongside the inner tube, you will create the layout you are aiming for.

<div id="leftbar">
   ...
</div>
<div class="innertube">
   ...
</div>
<div id="rightbar">
  ...
</div>

Additionally, don't forget to apply a float: left property to your inner tube.

Answer №3

The positioning of your header as position: absolute is causing it to be removed from the normal flow of the layout, resulting in the sidebars being hidden.

An example of a typical three-column layout with a header and footer could be structured like this:

HTML

<div class="header">Header</div>
<div class="wrapper">
    <div class="nav left">Left Navigation</div>
    <div class="nav right">Right Navigation</div>
    <div class="content">
    </div>
</div>
<div class="footer">Footer</div>

CSS

.nav {
    background: green;
    width: 100px;
}

.nav.left {
    float: left;
}

.nav.right {
    float: right;
}

.content {
    margin-left: 100px;
    margin-right: 100px;
}

For a visual representation, you can view the example on JSFiddle

Answer №4

It seems like there may be some confusion in your code. Are you aiming for a three-column layout with left and right bars, and the middle content containing frame content on top and main content at the bottom? Or is it more like left bar | frame content | right bar with main content underneath all three?

If you're going for a basic 3-column layout, you can achieve this without needing a div with a width of 100% and absolute position. Otherwise, the div will end up on top of the left and right bars.

Simply float the left bar to the left (float: left), float the middle content to the left as well, and float the right content to the right. This will give you the desired 3-column layout. If you want both frame content and main content in the middle, you can nest main content inside the frame content div.

I hope this clarifies things for you.

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

showcasing a map on an HTML webpage

Seeking advice on integrating a map feature in HTML to mark store locations. Working on an app for a business community and need help with this specific functionality. Your assistance would be greatly appreciated! ...

Material UI's Paper component is not expanding to full width when viewed on a smaller screen size

I'm currently working on a website project and utilizing a component for displaying dark mode. However, I've encountered an issue where the Component shrinks excessively when the screen size goes below 600px, unlike other components. This is a s ...

Switching the sorting criteria from 'AND' to 'OR' in the JPList library

I am currently exploring the use of JPList to sort on multiple items. As it stands, JPList searches like 'AND' when sorting (e.g. sorting based on an item with tags html, php and jQuery all together), but I am interested in filtering through all ...

What is the best way to align product cards side by side instead of stacking them on separate lines?

I am currently working on a mock-up website for a school project. For this project, I am developing a products page where I intend to showcase the items available for sale. Although I managed to successfully copy a template from w3schools, my challenge lie ...

Struggling to line up three images with linked attachments in a single row using Bootstrap 4

Currently tackling my portfolio for a school project, I find myself stuck on organizing my projects in a single line. Here is the code snippet that's giving me trouble... <div class="container"> <div class="row"> <div class= ...

What might be the reason for jQuery not functioning in Internet Explorer 11?

Working on developing a slideout menu for my website using jQuery. It functions perfectly in Chrome, but encountering issues in Internet Explorer (IE11). Extensive search hasn't provided a solution yet. Seeking assistance and any help would be highly ...

Implementing a keypress function that can handle duplicate names

HTML <input name="pm" type="text" value="0"/> <input name="pm" type="text" value="0"/> <input name="pm" type="text" value="0"/> <input name="total" type="text" value="0" disabled="disabled"/> Javascript $('[name="pm"]' ...

Encountering an issue when adding SASS Compass Breakpoint to my development project

I'm having trouble integrating breakpoints into my web project. I have SASS, Compass, and breakpoint all installed and I've followed the installation instructions, but it seems to be causing errors. Can someone help me troubleshoot the issue? He ...

Placing a Label Next to an Input Field using Bootstrap 4

Is there a way to position the label right next to the input form? I've attempted different methods without success. Could you please review my code below? <div class="modal-body"> <form class="form-horizontal"> <div cl ...

Tips for incorporating Javascript in an innerHTML inline css situation

I'm just starting to learn about html5 and php. I'm curious about how to incorporate javascript into my existing code. Currently, I have data from a database displayed in an HTML table. My goal is to align the output of the last cell more toward ...

What is the best way to modify the size of a canvas element while maintaining effectiveness?

I've encountered an issue while using Canvas to create a pie chart with chart.js. Despite adjusting the dimensions of the canvas element, it continues to take up the entire page. <canvas id="myChart" height ="200" width="200"></can ...

The full background width is not being displayed as 100% on the

Unexpectedly, the "full left secondary-bg" background division on this particular page (http://goo.gl/OU4MkW) is no longer spanning the full width of the screen and I am unable to figure out why. This website is WordPress-based and constructed using the sk ...

Tips for aligning the button and search bar in the center:In order

Currently still learning HTML, I'm facing an issue with centering a button and a search bar that are positioned beside each other. Despite trying multiple methods, I haven't been successful in achieving the desired centered layout while keeping t ...

Is it possible to override CSS classes in Ionic without using app.scss?

I'm currently working on designing a dark theme for my ionic application by watching this tutorial. It's been effective for most of the classes, however, I've encountered some CSS classes that only respond to overrides in app.scss. If I try ...

Scouring the web with Cheerio to extract various information from Twitter

Just starting out with Web Scraping, using Axios to fetch the URL and Cheerio to access the data. Trying to scrape my Twitter account for the number of followers by inspecting the element holding that info, but not getting any results. Attempting to exec ...

Forming a header area by utilizing a 960 Grid container

I'm in the process of designing a website utilizing the 960 Grid system. The header consists of three parts: the logo, the navigation, and the login form. I've implemented media queries to center both the logo and the login section when the pag ...

PHP and Ajax Form Submission Directing to Backend PHP Script

While working on a portfolio, I encountered an issue with the contact form. When I click the submit button to send a message, instead of displaying the bootstrap alert message below the form, the page redirects to the PHP file. Although I receive the emai ...

How can the Jquery UI Datepicker value be automatically set upon redirecting to this page?

When I submit a form and an error occurs, the value selected in the datepicker is not retained. The datepicker field remains empty. How is this possible? <html> <head> <script type="text/javascript" >. $(function() { ...

I am attempting to design an HTML page to serve as the body of an email. Can anyone advise me on how to effectively pass it into my setBody() function while using yiiMail?

On one of my .php pages, I have the following code snippet: <html> <head></head> <body> Hi <?php echo $user['first_name'].' '.$user['last_name']?>, <br><br> To reset your ...

Locate the parent element that has the smallest amount of space taken up by its child elements

My goal is to determine which container, among several <divs>, each containing multiple child <divs> of varying sizes, has the smallest amount of space covered by the child elements. <div class="container" id="first"> ...