Fluid layout causing elements in body to be hidden by fixed header

I'm currently tackling a fluid layout challenge, utilizing percentages instead of pixels to achieve it. I've managed to create a fixed heading (#heading) at the top of the page, but now I'm struggling with ensuring that all other elements on the site start right below this heading and don't disappear underneath it as the user scrolls down.

After some research, the only solution I found was to add padding to the top of the main content equal to the height of the heading. However, this method seems more suited for pixel-based designs and doesn't work seamlessly when using percentages across different browser window sizes or resolutions.

Implementing this solution didn't quite solve my issue because when I resize the browser window, the top of the main content still ends up hidden under the heading. Any guidance on how to tackle this would be greatly appreciated.

Here's an example of the browser window at a normal size: image1

And here is the same window decreased in size: image2

HTML:

<div id="wrap">
<div id="heading">
<div id="name">
   <img src="logo.svg" width=100%>
</div>
<div id="navbar">
    <a href="index.html">HOME</a> <a href="portfolio_start.html">PORTFOLIO</a> <a href="about.html">ABOUT</a><a href="contact.html">CONTACT</a> <a href="resume.html">RESUME</a>
</div>
</div>

<div id="site_content">
    <div id="side_panel_portfolio">
    <a href="portfolio_illustration.html">Illustration</a><br>
    <a href="portfolio_gd.html">Graphic Design</a> <br>
    <a href="portfolio_web.html">Web Design</a>
    </div>

    <div class="divider">
    </div> 

    <div id="mygallery">
    <!--(the images)-->
    </div>

    </div> <!--End of #site_content-->

    </div> <!--End of #wrap-->

CSS:

body {height:100%;
    font-family: 'Helvetica', sans-serif;
    font-weight:lighter;
    font-size:1.3vmax;}
#heading{height:14%;
    width:100%;
    font-family: 'Raleway', sans-serif;
    font-weight:300;
    background-color:#ffffff;
    top:0;
    padding-top:0;
    padding-left:0;
    Padding-right:0;
    position:fixed;
    z-index:100;}
#site_content{padding-top:6.7%;
        z-index:99;
        height:100%;}
#side_panel_portfolio{float:left;
    padding-left:3%;
    position:fixed;}
#mygallery{float:right;
        width:79%;
        padding-right:%;
        padding-left:3%;}
#portfolio_start{padding-left:18%;}
.divider{position:fixed;
    left:15%;
    top:14.7%;
    bottom:40%;
    border-left:1px solid black;}

In essence, I aim to have #site_content positioned just below #heading, with #mygallery being the only scrolling element. Appreciate your help in advance!

*I'd like to clarify that I'm temporarily using another artist's work as placeholders for development purposes only. The website is not live and will not contain these images upon completion.

Answer №1

Make sure to use a div element for the logo image to ensure responsiveness:

#logo {
display: block;
width: 100%;

}

<div id="logo">
  <img src="logo.svg">
</div>

It is also important to include all necessary media queries in your CSS file. For a helpful collection of device-specific CSS media queries, check out this link.

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

The website on iPad automatically zooms in upon opening and then increases the zoom level even further when a specific button is tapped

I recently coded a website using html, css, and js. It seems to work perfectly on all devices except for the iPad. Interestingly, when I use the iPad emulator in Google Chrome, everything appears normal. However, when I open the website on an actual iPad, ...

Performing two consecutive nested AJAX requests in jQuery using JavaScript

I am facing an issue with my code. My goal is to create a cryptocurrency ranking feature on my website. I have integrated an API that provides logos, symbols, indices, prices, etc. of cryptocurrencies. However, I encountered a problem as this API doesn&apo ...

What could be causing checked="checked" to fail validation in JavaScript?

I'm feeling a bit puzzled about this issue. Here's the HTML code I have - <input type="radio" id="20577091" name="q_engine" value="20577091" style="position: absolute; opacity:0;" checked="checked" /> and here is the corresponding JavaScr ...

What is the method for determining the intersection of multiple rgba values?

If I have the following CSS code: .example { background-color: rgba(0, 0, 0, 0.5); border-color: rgba(0, 0, 0, 0.5); } Even though the background-color and border-color share the same rgba value, they appear as different colors due to how the bor ...

Personalized sorting to match the unique rendering of cells in Material UI Data Grid

I have integrated the Material UI V4 Data Grid component into my React Js application. The Data Grid component requires two props: rows (list type) and columns (list type). Below is a sample row item: const rows = [ { id: 1, customerName: " ...

What is the best way to distinguish elements in the same HTML using Angular Material?

Currently, I am working on a project using Angular material, where I have a component.html file that defines a form and a table with data. In the first image of my project, you can see the tab title, a form to add new records, and the table displaying exi ...

THREE.js: dual scenes sharing identical camera positions

I'm currently working on a project where I have two overlapping scenes. The top scene can be faded in and out using a slider, and users can rotate objects within the scene for a better view. My challenge is to keep the camera position consistent betw ...

Issue encountered while trying to interpret Bootstrap 4 within Netbeans 8.2

Currently, I am working on an HTML5/JS application using Node.js in Netbeans 8.2. As I develop the welcome page, I intend to incorporate Bootstrap 4. However, when I attempt to add bootstrap.min.css to my stylesheets folder, I encounter an error as shown i ...

Creating dynamic selection options in an HTML select tag using PHP

When retrieving category and sub-category information from an API json file, the API returns category objects with a "parent" attribute. Main category objects have a parent attribute equal to 0, and sub-category objects have the parent attribute equal to t ...

Animate.css does not function properly when loaded locally

I'm currently using a Flask server to host an HTML file for testing purposes. Within the head of this HTML file, I have linked to a locally stored animate.min.css file (<link rel="stylesheet" type="text/css" href="{{ url_fo ...

Adjusting images of various sizes within a single row to fit accordingly

I am faced with a challenge of aligning a set of images on a webpage, each with varying heights, widths, and aspect ratios. My goal is to arrange them in a way that they fit seamlessly across the screen while ensuring their heights are uniform. Adjusting ...

Attempting to import a 3D model in the format of .glb

Encountered error in console: Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../". Attempting to load a 3D model, here are my index.html and 3dmodel.js files. Am I overlooking some ...

What are the steps to changing the navbar's color when scrolling down?

I am having trouble changing the color of my navigation bar from transparent to black after the user scrolls down. Despite trying various methods and watching tutorials, I can't seem to get it to work. HTML <nav role='navigation' class= ...

Ensure that the div element spans the entire width of the screen

Having issues working with the div tag and encountering this problem: The left side doesn't extend as far as the right side, despite testing in multiple browsers. Here is the HTML code being used: <!DOCTYPE html> <html lang="en"> <h ...

How should one go about properly sizing and formatting image icons?

Currently, I'm exploring the most efficient ways to optimize image loading speed on a webpage. Specifically, I am looking for advice on the best method for resizing an image from 1600x900 to 890x500. Method 1 Utilize the following code: <img src= ...

What is the best way to insert an image that is absolutely positioned inside a <td>?

I'm facing an issue with placing an absolutely positioned image inside a td. The code I have tried seems to create gaps above the image in FF 3.6 and causes the image to disappear in IE 7. I have included the necessary external style sheet elements ab ...

What is the correct way to utilize jquery's getJSON function?

<html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#hidebtn").click(function() { ...

Issues with Persistent Navbar Stickiness

I'm encountering an issue with the sticky navbar on my website. I implemented the code for this navbar from a tutorial at w3schools. However, the problem is that the sticky effect on the navigation menu doesn't seem to work correctly. The menu j ...

Separating a picture into distinct sections

Is there a way to divide an image into different parts to create hover effects? For example, hovering over the top part of the image triggers one change, and hovering over the bottom part triggers another change. This example demonstrates this concept usin ...

Issues arise with the HTML application cache while in offline mode after clicking the refresh button

I have encountered a problem with my web app that has been developed using application cache. I am currently testing it on Windows Phone 8.1 with the IE 11 mobile browser. Everything works smoothly when the internet connection is turned off and the web a ...