Transition Nav

i have in my html this layout that i want the list items to hidden and when i hover then they transit ease-in. now the transition is pushing down my main content which i dont want. i want to have iit stay put whiles the nav does its transitions.
my structure is as follows:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <title>
        
        </title>
        
        <style>
            html, body {
                
                margin:0;
                padding:0;
                background-image:url(../images/bgs/pgBackground.jpg);
                background-attachment: fixed;
                background-size: cover;
                background-position: center;
                background-repeat: no-repeat;
            }
            .mainEnvelope {
                width:100%;
               
            }
              header {
                width:100%;
                min-height:5rem;

            }
            .pageNavContainer {
                display: -webkit-flex;
                display: flex;
                flex-direction: row;
          
            }
            nav {
                width: 15%;
               background:rgba(255, 0, 0, 1);
               text-decoration: none;
               font-variant: small-caps;
               color: #fff;
               max-height: 3rem;
               overflow: hidden;
               -webkit-transition: all .2s ease-in 0s;
               -moz-transition: all .2s ease-in 0s;
               -ms-transition: all .2s ease-in 0s;
               -o-transition: all .2s ease-in 0s;
               transition: all .2s ease-in 0s;
            }
            
           .decorationOnly {
           background:rgba(0, 0, 0, 1);
           max-height: 3rem;
               flex: 1 1 80%;
               margin-left: 5px;
            }
                nav:hover {
        max-height: 1000px;
    }
            #mainWrapper {
                max-width: 65%;
                margin: 0 auto;
                display: -webkit-flex;
                display: flex;
                flex-direction:row nowrap;
                padding: 10px;
                border-radius:12px;
                background: #fff;
                min-height: 700px;
    /*            margin-top: -20px;*/
            }

        </style>
    </head>
    <body>
        <div class="mainEnvelope">
        <header>Header</header>
            <div class="pageNavContainer"><nav>
               <h3> <img src="../images/bgs/Down.ico" style="width:27px; height:28px;float:left; margin-right:.5em;">Navigation </h3>
                <ul  class="transitMenu">
                <li><a href="#">Home</a></li>
                     <li><a href="#">Home</a></li>
                     <li><a href="#">About Us</a></li>
                     <li><a href="#">Services</a></li>
                     <li><a href="#">Programs</a></li>
                     <li><a href="#">Contact Us</a></li>
                     <li><a href="#">Gallery</a></li>
                </ul>
            </nav>
            <nav class="decorationOnly">52</nav></div> 
    <!--        End of navigattion elements
        the last nav with class='decorationOnly" is just a decoration to get a lengthy red behind the main text at the top-->
            
        <section id="mainWrapper">
            <main>main content</main>
            <aside>aside</aside>
            <footer>Footer</footer>
        </section>
        </div>
        </body>

    </html>

Please edit your post and put three backticks on a line by themselves before the code, and three backticks on a line by themselves after the code.

```
your html and css here
```

<!DOCTYPE html>
<html lang="en">
<head>
    <title>
    
    </title>
    
    <style>
        html, body {
            
            margin:0;
            padding:0;
            background-image:url(../images/bgs/pgBackground.jpg);
            background-attachment: fixed;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }
        .mainEnvelope {
            width:100%;
           
        }
          header {
            width:100%;
            min-height:5rem;

        }
        .pageNavContainer {
            display: -webkit-flex;
            display: flex;
            flex-direction: row;
      
        }
        nav {
            width: 15%;
           background:rgba(255, 0, 0, 1);
           text-decoration: none;
           font-variant: small-caps;
           color: #fff;
           max-height: 3rem;
           overflow: hidden;
           -webkit-transition: all .2s ease-in 0s;
           -moz-transition: all .2s ease-in 0s;
           -ms-transition: all .2s ease-in 0s;
           -o-transition: all .2s ease-in 0s;
           transition: all .2s ease-in 0s;
        }
        
       .decorationOnly {
       background:rgba(0, 0, 0, 1);
       max-height: 3rem;
           flex: 1 1 80%;
           margin-left: 5px;
        }
            nav:hover {
    max-height: 1000px;
}
        #mainWrapper {
            max-width: 65%;
            margin: 0 auto;
            display: -webkit-flex;
            display: flex;
            flex-direction:row nowrap;
            padding: 10px;
            border-radius:12px;
            background: #fff;
            min-height: 700px;
/*            margin-top: -20px;*/
        }

    </style>
</head>
<body>
    <div class="mainEnvelope">
    <header>Header</header>
        <div class="pageNavContainer"><nav>
           <h3> <img src="../images/bgs/Down.ico" style="width:27px; height:28px;float:left; margin-right:.5em;">Navigation </h3>
            <ul  class="transitMenu">
            <li><a href="#">Home</a></li>
                 <li><a href="#">Home</a></li>
                 <li><a href="#">About Us</a></li>
                 <li><a href="#">Services</a></li>
                 <li><a href="#">Programs</a></li>
                 <li><a href="#">Contact Us</a></li>
                 <li><a href="#">Gallery</a></li>
            </ul>
        </nav>
        <nav class="decorationOnly">52</nav></div> 
<!--        End of navigattion elements
    the last nav with class='decorationOnly" is just a decoration to get a lengthy red behind the main text at the top-->
        
    <section id="mainWrapper">
        <main>main content</main>
        <aside>aside</aside>
        <footer>Footer</footer>
    </section>
    </div>
    </body>

</html>

i hope this does it right

You were close, you missed a ` at the end (you only had 2 of them)

sorry sorry ha ha thanks

<!DOCTYPE html>
<html lang="en">
<head>
    <title>
    
    </title>
    
    <style>
        html, body {
            
            margin:0;
            padding:0;
            background-image:url(../images/bgs/pgBackground.jpg);
            background-attachment: fixed;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }
        .mainEnvelope {
            width:100%;
           
        }
          header {
            width:100%;
            min-height:5rem;

        }
        .pageNavContainer {
            display: -webkit-flex;
            display: flex;
            flex-direction: row;
      
        }
        nav {
            width: 15%;
           background:rgba(255, 0, 0, 1);
           text-decoration: none;
           font-variant: small-caps;
           color: #fff;
           max-height: 3rem;
           overflow: hidden;
           -webkit-transition: all .2s ease-in 0s;
           -moz-transition: all .2s ease-in 0s;
           -ms-transition: all .2s ease-in 0s;
           -o-transition: all .2s ease-in 0s;
           transition: all .2s ease-in 0s;
        }
        
       .decorationOnly {
       background:rgba(0, 0, 0, 1);
       max-height: 3rem;
           flex: 1 1 80%;
           margin-left: 5px;
        }
            nav:hover {
    max-height: 1000px;
}
        #mainWrapper {
            max-width: 65%;
            margin: 0 auto;
            display: -webkit-flex;
            display: flex;
            flex-direction:row nowrap;
            padding: 10px;
            border-radius:12px;
            background: #fff;
            min-height: 700px;
/*            margin-top: -20px;*/
        }

    </style>
</head>
<body>
    <div class="mainEnvelope">
    <header>Header</header>
        <div class="pageNavContainer"><nav>
           <h3> <img src="../images/bgs/Down.ico" style="width:27px; height:28px;float:left; margin-right:.5em;">Navigation </h3>
            <ul  class="transitMenu">
            <li><a href="#">Home</a></li>
                 <li><a href="#">Home</a></li>
                 <li><a href="#">About Us</a></li>
                 <li><a href="#">Services</a></li>
                 <li><a href="#">Programs</a></li>
                 <li><a href="#">Contact Us</a></li>
                 <li><a href="#">Gallery</a></li>
            </ul>
        </nav>
        <nav class="decorationOnly">52</nav></div> 
<!--        End of navigattion elements
    the last nav with class='decorationOnly" is just a decoration to get a lengthy red behind the main text at the top-->
        
    <section id="mainWrapper">
        <main>main content</main>
        <aside>aside</aside>
        <footer>Footer</footer>
    </section>
    </div>
    </body>

</html>


this is mu layout: what i want is that the navigation should not push down the main content area. here when i hovered over the navigation and the content is pushed down.
Note: the header and nav are in a separate container that is displayed flex.

To keep the nav from affecting the subsequent content position, give drop-down absolute positioning. This will take it out of the document flow.

I was experiencing some weird float related problems last night and found this helpful for finding my way out of the mess

Simple Tips on Containing Floats

Thank you guys so much both advises were very helpful, ad the job is done well. am very grateful.

hi SamA74 regarding this topic i have realise the element i have below the nav element hav stuch on top of the nav and no amount of margin will push it away.
the lay out is like this:

<div classs="pageNavContainer">
<nav><ul><li></li></ul></nav>
<div id="mainPageContent">
<div>

my problem is the mainPageContent sticking to the top of the navcontainer. i wanted to have stay at the middle of it so that its background can still be seen at the top. now the element below it is covered it. i will be posting the image and full code sooner. thanks for reading

this is the full code, it contains the html and css for now.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>
    
    </title>
    
    <style>
        html, body {
            
            margin:0;
            padding:0;
            background-image:url(../images/bgs/pgBackground.jpg);
            background-attachment: fixed;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }
/*this code below is the 
        first wrapper after body*/
        .mainEnvelope {
            width:100%;
            position: relative;
        }
        header {
            
            min-height: 6rem;
            color:chartreuse; 
            letter-spacing: .2em;
            font-size: 36px;
            text-align: center;
        }
/*this code below is the 
         wrapper for all the header area content;
        and they include header, 
        nav and ite child ul and grand child li */
        .pageNavContainer {
            width:99.8%;
            margin: 1rem auto;
            background:rgb(255, 0, 0);
            max-height: 3rem;
             border-radius: 0 10px 10px 0;
        }
        .pageNavContainer h3 {
            color:chartreuse; 
            font-weight: 800;
           
        }
        nav {
            box-shadow: 0 0 13px;
            position: absolute;
            top: ;
            left: .1rem;
            border:1px solid yellow;
            width:15%;
            max-height: 3rem;
            overflow: hidden;
            -webkit-transition: all .2s ease 0s;
             -moz-transition: all .2s  ease 0s;
             -ms-transition: all .2s ease 0s;
             -o-transition: all .2s ease 0s;
                transition: all .2s ease 0s;
            
        }
        nav:hover {
            max-height: 1000px;
        }
/*this code below is the 
         wrapper for the main page content
        kown as body text. it wraps three classes known as flexOrder1, 2, and 3, which also wraps three different element individually.
        within themselves. */
        #mainWrapper {
            border-radius: 30px 30px 0 0;
            display: -webkit-flex;
            display: flex;
            flex-flow: row wrap;
        }
        #mainWrapper {
            min-height: 500px;
            width: 68%;
            background: #fff;
            margin:0 auto;
            padding: .5em;
            
        }
        .flexOrder1 {
            padding: 0;
            margin: 0;
            order: 1;
            width: 79%;
            margin-right: .5%;
            border-right: .5px dotted #ccc;
        }
        .flexOrder2 {
            padding: 0;
            margin: 0;
            order: 2;
            width: 20%;
            margin: 1rem 0;
            padding: 0;
        }
          .flexOrder3 {
            padding: 0;
            margin: 0;
            order: 3;
            width: 100%;
            margin: 1rem 0;
            padding: 0;
        }
        main {
            padding: 0;
            margin: 0;
            width: 99%;
            margin-right: 1%;
           
        }
         aside {
            padding: 0;
            margin: 0;
            width: 99%;
            margin-right: 1%;
             
        }
         footer {
            padding: 0;
            margin: 0;
            width: 100%;
            margin: 0;
           
        }
     
        
            
           
     
   

    </style>
</head>
<body>
    <div class="mainEnvelope">
    <header>Header</header>
        <div class="pageNavContainer">
            <nav>
           <h3> <img src="../images/bgs/Down.ico" style="width:27px; height:28px;float:left; margin-right:.5em;">Navigation </h3>
            <link rel="stylesheet" href="mbcsmbl6h0.css" type="text/css" />

<ul id="ebul_mbl6h0_3" class="ebul_mbl6h0" style="display: none;">
<li><a title="">Product Group A</a>
  <ul id="ebul_mbl6h0_3_1">
  <li><a title="">Product AA</a></li>
  <li><a title="">Product AB</a></li>
  </ul></li>
<li><a title="">Product Group B</a>
  <ul id="ebul_mbl6h0_3_4">
  <li><a title="">Product BA</a></li>
  <li><a title="">Product BB</a></li>
  </ul></li>
<li><a title="">Product Group C</a></li>
</ul>
<ul id="ebul_mbl6h0_4" class="ebul_mbl6h0" style="display: none;">
<li><a title="">Service A</a></li>
<li><a title="">Service B</a></li>
<li><a title="">Service C</a></li>
</ul>
<ul id="ebul_mbl6h0_5" class="ebul_mbl6h0" style="display: none;">
<li><a title="">Frequently Asked Questions</a></li>
<li><a title="">Forms</a></li>
<li><a title="">Halaka</a></li>
</ul>

<ul id="mbl6h0ebul_table" class="mbl6h0ebul_menulist" style="width: 95px; height: 210px;">
  <li class="spaced_li"><a><img id="mbi_mbl6h0_1" src="mb_home.gif" name="mbi_mbl6h0_1" width="95" height="30" style="vertical-align: bottom;" border="0" alt="Home" title="" /></a></li>
  <li class="spaced_li"><a><img id="mbi_mbl6h0_2" src="mb_about_us.gif" name="mbi_mbl6h0_2" width="95" height="30" style="vertical-align: bottom;" border="0" alt="About Us" title="" /></a></li>
  <li class="spaced_li"><a><img id="mbi_mbl6h0_3" src="mb_programs.gif" name="mbi_mbl6h0_3" width="95" height="30" style="vertical-align: bottom;" border="0" alt="Programs" title="" /></a></li>
  <li class="spaced_li"><a><img id="mbi_mbl6h0_4" src="mb_services.gif" name="mbi_mbl6h0_4" width="95" height="30" style="vertical-align: bottom;" border="0" alt="Services" title="" /></a></li>
  <li class="spaced_li"><a><img id="mbi_mbl6h0_5" src="mb_support.gif" name="mbi_mbl6h0_5" width="95" height="30" style="vertical-align: bottom;" border="0" alt="Support" title="" /></a></li>
  <li class="spaced_li"><a><img id="mbi_mbl6h0_6" src="mb_news_media.gif" name="mbi_mbl6h0_6" width="95" height="30" style="vertical-align: bottom;" border="0" alt="News/Media" title="" /></a></li>
  <li><a><img id="mbi_mbl6h0_7" src="mb_company.gif" name="mbi_mbl6h0_7" width="95" height="30" style="vertical-align: bottom;" border="0" alt="Company" title="" /></a></li>
</ul>
<script type="text/javascript" src="mbjsmbl6h0.js"></script>
<!--
                <ul  class="transitMenu">
            <li><a href="#">Home</a></li>
                 <li><a href="#">Home</a></li>
                 <li><a href="#">About Us</a></li>
                 <li><a href="#">Services</a></li>
                 <li><a href="#">Programs</a></li>
                 <li><a href="#">Contact Us</a></li>
                 <li><a href="#">Gallery</a></li>
            </ul>
-->
        </nav>
        
    <section id="mainWrapper">
       <div class="flexOrder1"> 
           <main>
<h2>Main</h2>
Hi i have an image to use for my pages background, the page width will be Hi i have an image to use for my pages background, the page width will be 80% of the view-port.  
</main></div>
       <div class="flexOrder2">  
           <aside>
            <h2>Aside</h2>view-port. my bg image is 200px x 200px.ool block
          </aside></div>
        
        <div class="flexOrder3">  
            <footer><h2>Footer</h2>Footer datax 200px. what properties am i to use to have it span the page without me seeing borders or </footer></div>
    </section>
    </div>
    </body>

</html>



Here is the image with the white area jumping up to the red div which wraps the nav element. i have made the nav about 12% width or so within its container. at the mooment its the container of the nav element that has the bottom element of it jump up.

Before you go any further, you need to validate your code.
Use either the url, a file upload or paste in the input as I have, which resulted in 12 errors and 7 warnings.
You will then need to work through and eliminate each error.

Your nav is absolutely placed and absolute elements are removed from the flow so any other content will not care that it is there. Therefore the middle section starts as high as it can because nothing is in the way. You should really have the navigation container as position:relative to preserve the space and then set the dropdown portion to position:absolute so that it doesn’t push content down.

Your red bar has been set to a max-height of 3rem which effectively means that the content in the middle is overflowing and will likely cause you considerable problems should you try to put anything under that middle section but not contained within in.

The red bar should be a separate element not a container for the middle content and should take up space in the flow as required. Then you can place your middle content underneath it assuming that is what you wanted.

I’d need to see a drawing of the result you are after to offer more specific advice :smile:

1 Like

Thanks a lot PaulOB; here is the picture of what i want to accomplish:

PaulOB i have removed the end div tag and placed it at its position, just above the main content div.
i have also positioned the parent div of the nav element relative and this caused the nav parent to shorten in lenght. it became same width as the nav element but the bottom element has now got back to its place. seeing i commented on the nav css and strangely the nav parent element went back to its original width which is 98.9% will post a picture in a minute

here is the result of turning my nav css code off after relative position of the parent of the nav and also placing the end div tag below the nav ending tag. Note i will post two images one with the css of nav on and the its turn off
the one below has this code turned off:

           
/*
        }
        nav {
            box-shadow: 0 0 13px;
            position: absolute;
            top: ;
            left: .1rem;
            border:1px solid yellow;
            width:15%;
            max-height: 3rem;
            overflow: hidden;
            -webkit-transition: all .2s ease 0s;
             -moz-transition: all .2s  ease 0s;
             -ms-transition: all .2s ease 0s;
             -o-transition: all .2s ease 0s;
                transition: all .2s ease 0s;
            
        }
        nav:hover {
            max-height: 1000px;
        }
*/

sorry i dint upload the other image before posting:

i have been able to clean the code from all errors now by validation. its now error free just battling with same old nav element

1 Like

hi there just want to report i have finally fixed the issue with the nav and overflow. below is the end result