html - Issue with aligning back arrow with dropdown -
having issues spacing arrow next dropdown. issue is centering arrow if dropdown active. want on left of dropdown not aligned how is.
i included jsfiddle show display.
html
<div id="portfolio"> <table> <tr> <td> <a href="index.html"><div class="back-arrow-left" ></div></a> </td> <td> <dropdown> <input id="toggle2" type="checkbox"> <label for="toggle2" class="animate">portfolio<i class="fa fa-list float-right"></i></label> <ul class="animate"> <li class="animate">websites</li> <li class="animate">computer animations</li> <li class="animate">c/c++ programs</li> </ul> </dropdown> </td> </tr> </table> </div>
css
.back-arrow-left { width: 0; height: 0; border-top: 30px solid transparent; border-bottom: 30px solid transparent; border-right:30px solid gray; vertical-align: top; } .back-arrow-left:hover { border-right:30px solid #1abc9c; } #portfolio{ width: 400px; float: right; } *{ padding: 0; margin: 0; font-family: 'lato', sans-serif; box-sizing: border-box; } .float-right{ float: right; } .fa{ font-size: .8em; line-height: 22px !important; } dropdown{ display: inline-block; margin: 0px 50px; } dropdown label, dropdown ul li{ display: block; width: 200px; background: #ecf0f1; padding: 15px 20px; } dropdown label:hover, dropdown ul li:hover{ background: #1abc9c; color: white; cursor: pointer;} dropdown label{ color: #1abc9c; border-left: 4px solid #1abc9c; border-radius: 0 5px 0 0; position: relative; z-index: 2; } dropdown input{ display: none; } dropdown input ~ ul{ position: relative; visibility: hidden; opacity: 0; top: -20px; z-index: 1; } dropdown input:checked + label{ background: #1abc9c; color: white; } dropdown input:checked ~ ul{ visibility: visible; opacity: 1; top: 0; } $colors: #e74c3c, #0072b5, #2c3e50; @for $i 1 through length($colors) { dropdown ul li:nth-child(#{$i}) { border-left: 4px solid nth($colors, $i); .fa{ color: nth($colors, $i); } &:hover { background: nth($colors, $i); color: white; .fa{ color: white; } } } } .animate{ -webkit-transition: .3s; -moz-transition: .3s; -ms-transition: .3s; -ms-transition: .3s; transition: .3s; backface-visibility:hidden; -webkit-backface-visibility:hidden; /* chrome , safari */ -moz-backface-visibility:hidden; /* firefox */ -ms-backface-visibility:hidden; /* internet explorer */
is there particular reason using table? not html 5 compliant, , cause issues later on.
in fact, table causing problem. have table surrounding data should orientate order want, using css align out table!
if take out table , add 1 line css work perfectly.
.back-arrow-left { float: left; width: 0; height: 0; border-top: 30px solid transparent; border-bottom: 30px solid transparent; border-right:30px solid gray; vertical-align: top; } <div id="portfolio"> <a href="index.html"><div class="back-arrow-left" ></div></a> <dropdown> <input id="toggle2" type="checkbox"> <label for="toggle2" class="animate">portfolio<i class="fa fa-list float-right"></i></label> <ul class="animate"> <li class="animate">websites</li> <li class="animate">computer animations</li> <li class="animate">c/c++ programs</li> </ul> </dropdown> </div>
Comments
Post a Comment