html - css " display: inline-block for 3 column" -


i wondering everytime set width in first column of display-inline-block css method, other column go down how many pixel if use padding instead of width other column not go down. can explain me why happening? newbie here

the first picture using width in first column

enter image description here

second image using padding

enter image description here

the code

body {    font-family: "arial",helvetica, sans-serif, serif;    color: white;    background: gray;    margin: 0;  }  div.wrapper {    border: 3px black dashed;  }    /*===============header===================*/  header.main-header {    border: 2px pink dashed;  }  h1.main-h1 {    margin: 10px 0 0 0;    border: 1px black solid;    text-align: center;  }  p.p-header {    font-style: italic;    margin-top: 0;    padding-left: 57.5%;    position: absolute;    top: 27px;     line-height: 12px;  }  /*==============end of header============*/    /*==============navigation bar===========*/  nav.main-nav {    border: 2px green solid;    text-align: center;  }  p.p-nav {    margin: 0;    right: 1%;  }  /*============end of navigation=========*/    /*============section===================*/  div.column {    border: 2px blue dashed;  }  section.second-column, section.third-column, section.first-column {    border: 2px brown solid;    display: inline-block;    height: 450px;  }  section.first-column {    padding-right: 4%;    margin-left: 1%;  }  section.second-column {    width: 60%;    margin-left: 1%;  }  section.third-column {    width: 20%;    margin-left: 1%;  }  /*==============footer==================*/  footer.main-footer {    border: 1px white solid;    text-align: center;    clear: both;  }  /*=============end of footer===========*/
<!doctype html>  <html lang="eng">    <head>      <meta charset="utf-8">      <link rel="stylesheet" href="_css/typhography.css">      <title>typhography</title>    </head>    <body>      <div class="wrapper">        <header class="main-header">          <h1 class="main-h1">typhography</h1>          <p class="p-header">learning things<br>with showe</p>        </header>        <nav class="main-nav">          <p class="p-nav">this navigation section</p>        </nav>        <div class="column">          <section class="first-column">this first column</section>          <section class="second-column">this second column</section>          <section class="third-column">this third column</section>        </div>        <footer class="main-footer">          <small>this footer</small>        </footer>      </div>    </body>  </html>

set vertical-align: top column elements.

section.second-column, section.third-column, section.first-column {   border: 2px brown solid;   display: inline-block;   height: 450px;   vertical-align: top; } 

you can read more vertical-align here , here


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -