html - Why won't my nav be 100% in width relative to the browser -
if test out code , resized browser window, last list-item "sign up" when hovered (is way tell) doesn't stretch 100%. i've tried many different ways. if can test out , find solution; please explain how fixed way can learn. please.
html, body { margin: 0; padding: 0; height: 100%; width: 100%; background-color: rgba(182, 182, 182, 1); } div.main_container { position: fixed; height: 100%; width: 100%; background-image: url("../images/img_0060.jpg"); background-repeat: no-repeat; background-size: cover; background-attachment: fixed; } div.nav_container { position: fixed; z-index: 1; height: 50px; width: 100%; min-width: 700px; background-color: rgba(34, 34, 34, .75); } ul.nav { margin: 0; padding: 0; list-style: none; list-style-type: none; height: 100%; width: 100%; } ul.nav li { background-color: transparent; display: table; float: left; height: 50px; width: 12.5%; text-align: center; } ul.nav li marquee { position: relative; display: table-cell; vertical-align: middle; color: white; font-weight: bold; font-family: fantasy; } ul.nav li { text-decoration: none; text-transform: capitalize; font-family: fantasy; position: relative; display: table-cell; vertical-align: middle; color: lightgray; font-weight: bold; } ul.nav li:hover { background-color: rgba(205, 205, 205, .50); } ul.nav li:hover marquee { background-color: black; color: lightgreen; } ul.nav li:hover { color: black; }
<!doctype html> <html lang="en-us"> <head> <title>kendall's portfolio</title> <link rel="stylesheet" type="text/css" href="css/index.css" /> </head> <body> <div class="main_container"> <div class="nav_container"> <ul class="nav"> <li> <a href="#">home</a> </li> <li> <a href="#">kendall</a> </li> <li> <a href="#">projects</a> </li> <li> <a href="#">social</a> </li> <li> <a href="#">tutorials</a> </li> <li> <marquee scrollamount="2"> sliding text </marquee> </li> <li> <a href="#">login</a> </li> <li> <a href="#">sign up</a> </li> </ul> <!--closing of nav--> </div> <!--closing of nav_container--> </div> <!--closing of main_container--> </body> </html>
you can change last-child
of ul.nav li
float:right
html, body { margin: 0; padding: 0; height: 100%; width: 100%; background-color: rgba(182, 182, 182, 1); } div.main_container { position: fixed; height: 100%; width: 100%; background-image: url("../images/img_0060.jpg"); background-repeat: no-repeat; background-size: cover; background-attachment: fixed; } div.nav_container { position: fixed; z-index: 1; height: 50px; width: 100%; min-width: 700px; background-color: rgba(34, 34, 34, .75); } ul.nav { margin: 0; padding: 0; list-style: none; list-style-type: none; height: 100%; width: 100%; } ul.nav li { background-color: transparent; display: table; float: left; height: 50px; width: 12.5%; text-align: center; } ul.nav li:last-child { float:right; } ul.nav li marquee { position: relative; display: table-cell; vertical-align: middle; color: white; font-weight: bold; font-family: fantasy; } ul.nav li { text-decoration: none; text-transform: capitalize; font-family: fantasy; position: relative; display: table-cell; vertical-align: middle; color: lightgray; font-weight: bold; } ul.nav li:hover { background-color: rgba(205, 205, 205, .50); } ul.nav li:hover marquee { background-color: black; color: lightgreen; } ul.nav li:hover { color: black; }
<!doctype html> <html lang="en-us"> <head> <title>kendall's portfolio</title> <link rel="stylesheet" type="text/css" href="css/index.css" /> </head> <body> <div class="main_container"> <div class="nav_container"> <ul class="nav"> <li> <a href="#">home</a> </li> <li> <a href="#">kendall</a> </li> <li> <a href="#">projects</a> </li> <li> <a href="#">social</a> </li> <li> <a href="#">tutorials</a> </li> <li> <marquee scrollamount="2"> sliding text </marquee> </li> <li> <a href="#">login</a> </li> <li> <a href="#">sign up</a> </li> </ul> <!--closing of nav--> </div> <!--closing of nav_container--> </div> <!--closing of main_container--> </body> </html>
Comments
Post a Comment