html - SVG image as :after border without fixed height? -
okay, here jsfiddle of nav in current project. i'm not sure if i'm going in best way, want logo centered in middle of nav , 3 links centered around logo.
however, need site responsive: able handle variety of screen widths smoothly. suggestions?
also, want able use .png border on divs without needing set fixed height. however, when set height:auto
background-color disappears.
html:
<div id="header-wrap" class="group"> <nav> <a href="index.html"><img class="logo" src="http://i60.tinypic.com/1zxqqm1.png" alt="cat town cafe & adoption" /></a> <ul> <li><a href="index.html">about</a> </li> <li><a href="index.html">our cats</a> </li> <li><a href="index.html">reservations</a> </li> <li><a href="index.html">donate</a> </li> <li><a href="index.html">help out</a> </li> <li><a href="index.html">contact</a> </li> </ul> </nav> </div>
css:
#header-wrap { width: 100%; height: auto; position: relative; background-color: #e6d7b8; z-index: 5; } #header-wrap:after { width: 100%; height: 4px; background: url("http://i57.tinypic.com/30uxn47.png") repeat-x; -webkit-transform: rotate(-180deg); -moz-transform: rotate(-180deg); -ms-transform: rotate(-180deg); -o-transform: rotate(-180deg); transform: rotate(-180deg); position: absolute; bottom: -4px; left: 0; display: block; content:""; z-index: 5; } nav { background: #e6d7b8; height: 60px; position: relative; } nav ul { margin: 0 auto; padding: 0; list-style: none; } nav li { display: block; float: left; padding: 0 18px; height: 60px; text-align: center; display: flex; flex-direction: column; justify-content: center; position: relative; font: 400 14px'bitter'; letter-spacing: 0.05em; color: #893b4e; text-transform: uppercase; text-decoration: none; } nav li a:hover { box-shadow: inset 0px 4px 0px #4c264b; } nav li a:hover:before { width: 100%; height: 100px; background: linear-gradient(#4c264b, transparent); display: block; content:""; position: absolute; left: 0; z-index: -1; } nav ul li { float: left; } nav ul li:nth-of-type(4) { margin-left: 277px; } .logo { position: absolute; left: 50%; margin: 0 0 0 -135px; max-width: 270px; z-index: 100; }
put .logo
inside ul
, you'll need make changes css.
fiddle
html:
<div id="header-wrap" class="group"> <nav> <ul> <li><a href="index.html">about</a> </li> <li><a href="index.html">our cats</a> </li> <li><a href="index.html">reservations</a> </li> <li class="logo"> <a href="index.html"></a> </li> <li><a href="index.html">donate</a> </li> <li><a href="index.html">help out</a> </li> <li><a href="index.html">contact</a> </li> </ul> </nav> </div>
css:
#header-wrap { width: 100%; height: auto; position: relative; background-color: #e6d7b8; z-index: 5; } #header-wrap:after { width: 100%; height: 4px; background: url("http://i57.tinypic.com/30uxn47.png") repeat-x; -webkit-transform: rotate(-180deg); -moz-transform: rotate(-180deg); -ms-transform: rotate(-180deg); -o-transform: rotate(-180deg); transform: rotate(-180deg); position: absolute; bottom: -4px; left: 0; display: block; content:""; z-index: 5; } nav { background: #e6d7b8; height: 60px; position: relative; width: 100%; margin: 0 auto; } nav ul { margin: 0 auto; width: 870px; padding: 0; list-style: none; } nav li { display: block; float: left; padding: 0 18px; height: 60px; text-align: center; display: flex; flex-direction: column; justify-content: center; position: relative; font: 400 14px'bitter'; letter-spacing: 0.05em; color: #893b4e; text-transform: uppercase; text-decoration: none; } nav li:not(.logo) a:hover { box-shadow: inset 0px 4px 0px #4c264b; } nav li:not(.logo) a:hover:before{ width: 100%; height: 100px; background: linear-gradient(#4c264b, transparent); display: block; content:""; position: absolute; left: 0; z-index: -1; } nav ul li { float: left; } .logo { width: 200px; height: 130px; position: relative; background: url(http://i60.tinypic.com/1zxqqm1.png) no-repeat; background-size: 100% 100%; background-position: 0% 0%; z-index: 10; }
Comments
Post a Comment