html - Aligning nav bar to header image -


hopefully quick question: trying make nav bar appear next logo, not working. have tried solutions provided on other questions , none seem work. have tried float:left; header , float:right; nav, not display correctly. thank in advance help. here code:

body{      width:90%;      padding-left:3%;      padding-right:3%;    }    header{      float:left;  }    nav{      background-color: yellowgreen;      padding-left: 2em;      white-space: nowrap;  }  header.banner > nav a:link{  	    font-size:large;      text-decoration: none;      color:white;      margin-right:20%;     }  header.banner > nav a:hover{      text-decoration: underline;  }    section{      float:left;      column-count:3;      column-gap:2em;  }
<!doctype html>  <html>  <head>        <link rel="stylesheet" type="text/css" href="style.css" />  </head>  <body>  <header class="banner">  <a title="cleveland state university" href="http://www.csuohio.edu/">  <img src="csu shield.png" alt="csushield"  alt="navigation cleveland state university's website" />  </a>  <nav>      <a href="cis.csuohio.edu/~hubteibe/cba.html">home</a>      <a href="cis.csuohio.edu/~hubteibe/internships.html">internships</a>      <a href="cis.csuohio.edu/~hubteibe/co-ops.html">co-ops</a>      <a href="cis.csuohio.edu/~hubteibe/careers.html">careers</a>  </nav>  <h1>college of business internships, co-ops, , career programs</h1>  </header>

just make following changes css,

header{     float:left;     width:100% } header > a{     float: left; } nav{     background-color: yellowgreen;     padding-left: 2em;     white-space: nowrap;     float: left; } header.banner > nav a:link{     font-size:large;     text-decoration: none;     color:white;     padding: 0 20px;    } 

the property margin-right: 20% given header.banner > nav a:link creating problem. usually, these kind of situations supposed use left , right paddings.

<-------------update------------>

to take whole width, this,

*{     box-sizing: border-box; } header > a{     float: left;     width: 20%; } nav{    white-space: nowrap;    float: left;    width: 80%;    margin-bottom: 25px; } header.banner > nav a:link{     font-size: large;     text-decoration: none;     color: white;     padding: 16px 20px;     background-color: yellowgreen;     float: left;     width: 25%;     text-align: center;    } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -