New navigation and a css problem

Joined
Oct 2, 2006
Messages
1
Reaction score
0
Hi guys,

im working on a new navigation for my website. The idea is to place a "status bar" on the bottom of the screen and use it for navagation and login/search functions in the site.

Im trying to make 2 separate DIVs, 1st(top) will be a scrollable container for the website content using all the available space except 40px which will be used for the 2nd (bottom) div - "status bar".
I cant make the proper CSS(dunno if it is possible at all). All the tries ended with half hidden scroll bar or other problems


There is an easy way to do it with frames but its not an option for me.

Any help will be appreciated,
Thanks
Hristo Salabashev
taumedia.com
 
Joined
Nov 5, 2024
Messages
5
Reaction score
0
aight, so:
your trying to set up a clean nav with a fixed status bar at the bottom. u can perfomr this layout using: flexbox/css grid to control the space correctly w/o hidden scroll bars. e.g

CSS:
html, body {
    height: 100%;
    margin: 0;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.content {
    flex: 1;
    overflow-y: auto;
}

.status-bar {
    height: 40px;
    background-color: [input ur colour];
}

I hope this can help you.
 
Joined
Jul 4, 2023
Messages
591
Reaction score
78
Have you tried using position: fixed; for the status bar?
HTML:
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <style>
      html,
      body {
        --status-bar-height: 40px;
        height: 100dvh;
        margin: 0;
        padding: 0;
      }
      main {
        padding: 1rem;
        padding-bottom: calc(var(--status-bar-height) * 1.125);
      }
      .status-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--status-bar-height);
        padding: .5rem 1rem;
        background-color: hotpink;
        opacity: .9;
        box-sizing: border-box;
      }

      /* for demonstration purposes */
      p {
        text-indent: 1rem;
      }
    </style>
  </head>
  <body>
    <div class="status-bar">Lorem</div>
    <main></main>


    <!-- for demonstration purposes -->
    <script>
      window.onload = () => {
        const lorem = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. ';
        document.querySelector('main').innerHTML = `<p>${lorem.repeat(100)}</p>`.repeat(3);
      }
    </script>
  </body>
</html>
1731717985718.png
 
Last edited:
Joined
Jul 4, 2023
Messages
591
Reaction score
78
u can perfomr this layout using: flexbox/css
In addition to flex, you can also use grid.
HTML:
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <style>
      html,
      body {
        margin: 0;
        padding: 0;
      }
      body {
        display: grid;
        grid-template-rows: 1fr 40px;
        height: 100dvh;
      }
      main {
        padding: 1rem;
        overflow-y: auto;
      }
      .status-bar {
        padding: .5rem 1rem;
        background-color: hotpink;
        box-sizing: border-box;
      }

      /* for demonstration purposes */
      p {
        text-indent: 1rem;
      }
    </style>
  </head>
  <body>  
    <main></main>
    <nav class="status-bar">Lorem</nav>

    <!-- for demonstration purposes -->
    <script>
      window.onload = () => {
        const lorem = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. ';
        document.querySelector('main').innerHTML = `<p>${lorem.repeat(100)}</p>`.repeat(3);
      }
    </script>
  </body>
</html>
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,082
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top