html - ul is applying styles but from where? -
i'm having trouble find reason why class named nav
in ul
element applying styles.
i'm using nav
element directly style (without using classes). gave ul
element class named nav
, applying styles (but where?).
i had give ul
margin: 0
, still have left padding
, these styles coming from?
i'm not experienced css , i'd appreciate help.
this reproduced
body { background-color: #fff; margin: 0; font-family: 'open sans', sans-serif; font-size: 14px; line-height: 1.42857143; color: #333; } /* header */ header { min-height: 750px; background: url(https://static.inmopaco.tk/images/banner2.jpg) no-repeat 0px 0px; background-size: cover; position: relative; } /* top bar menu */ .top-menu { background: rgba(78, 197, 241, 0.81); padding: 0.5em 0; } /* nav links */ nav { background: none; border: none; margin: 2.2em 0 0; float: left; padding-left: 5%; min-height: 50px; } nav:nth-child(3) { float: right; padding: 0 5% 0 0; } nav ul { list-style: none; margin: 0; } nav ul li { margin: 0 1em; } nav ul > li { float: left; } nav ul li { color: #fff; font-size: 1.2em; padding: 0; font-weight: 600; -webkit-transition: color 0.3s; -moz-transition: color 0.3s; -o-transition: color 0.3s; transition: color 0.3s; } nav ul li a:hover, nav ul li a.active { color: #000; background: none; } nav ul li a::before { position: absolute; top: 65%; left: 50%; color: transparent; content: '.'; text-shadow: 0 0 transparent; font-size: 1.7em; -webkit-transition: text-shadow 0.3s, color 0.3s; -moz-transition: text-shadow 0.3s, color 0.3s; -o-transition: text-shadow 0.3s, color 0.3s; transition: text-shadow 0.3s, color 0.3s; -webkit-transform: translatex(-50%); -moz-transform: translatex(-50%); -ms-transform: translatex(-50%); -o-transform: translatex(-50%); transform: translatex(-50%); pointer-events: none; } nav ul li a:hover::before, nav ul li a:focus::before, nav ul li a.active::before { color: #fff; text-shadow: 10px 0 #000, -10px 0 #000; } /* logo */ .logo { position: absolute; left: 50%; margin: 7px -90px 0; } .logo img { width: 75%; } .clearfix:before, .clearfix:after, .dl-horizontal dd:before, .dl-horizontal dd:after, .container:before, .container:after, .container-fluid:before, .container-fluid:after, .row:before, .row:after, .form-horizontal .form-group:before, .form-horizontal .form-group:after, .btn-toolbar:before, .btn-toolbar:after, .btn-group-vertical > .btn-group:before, .btn-group-vertical > .btn-group:after, nav:before, nav:after, .nav:before, .nav:after, .navbar:before, .navbar:after, .navbar-header:before, .navbar-header:after, .navbar-collapse:before, .navbar-collapse:after, .pager:before, .pager:after, .panel-body:before, .panel-body:after, .modal-footer:before, .modal-footer:after { display: table; content: " "; } .clearfix:after, .dl-horizontal dd:after, .container:after, .container-fluid:after, .row:after, .form-horizontal .form-group:after, .btn-toolbar:after, .btn-group-vertical > .btn-group:after, nav:after, .nav:after, .navbar:after, .navbar-header:after, .navbar-collapse:after, .pager:after, .panel-body:after, .modal-footer:after { clear: both; }
<body> <header> <div class="top-menu"> <nav> <ul class="nav"> <li><a class="home active">inicio</a> </li> <li><a class="services scroll">servicios</a> </li> <li><a class="aboutus">sobre nosotros</a> </li> </ul> </nav> <a class="logo"> <img src="//static.inmopaco.tk/images/logo.png"> </a> <nav> <ul class="nav"> <li><a class="home">inscripciĆ³n</a> </li> <li><a class="services">acceso</a> </li> </ul> </nav> <div class="clearfix"></div> </div> </header> </body>
ul
default has margin
, padding
, , reset margin
, have reset padding
well
body { background-color: #fff; margin: 0; font-family: 'open sans', sans-serif; font-size: 14px; line-height: 1.42857143; color: #333; } /* header */ header { min-height: 750px; background: url(https://static.inmopaco.tk/images/banner2.jpg) no-repeat 0px 0px; background-size: cover; position: relative; } /* top bar menu */ .top-menu { background: rgba(78, 197, 241, 0.81); padding: 0.5em 0; } /* nav links */ nav { background: none; border: none; margin: 2.2em 0 0; float: left; padding-left: 5%; min-height: 50px; } nav:nth-child(3) { float: right; padding: 0 5% 0 0; } nav ul { list-style: none; margin: 0; padding: 0 } nav ul li { margin: 0 1em; } nav ul > li { float: left; } nav ul li { color: #fff; font-size: 1.2em; padding: 0; font-weight: 600; -webkit-transition: color 0.3s; -moz-transition: color 0.3s; -o-transition: color 0.3s; transition: color 0.3s; } nav ul li a:hover, nav ul li a.active { color: #000; background: none; } nav ul li a::before { position: absolute; top: 65%; left: 50%; color: transparent; content: '.'; text-shadow: 0 0 transparent; font-size: 1.7em; -webkit-transition: text-shadow 0.3s, color 0.3s; -moz-transition: text-shadow 0.3s, color 0.3s; -o-transition: text-shadow 0.3s, color 0.3s; transition: text-shadow 0.3s, color 0.3s; -webkit-transform: translatex(-50%); -moz-transform: translatex(-50%); -ms-transform: translatex(-50%); -o-transform: translatex(-50%); transform: translatex(-50%); pointer-events: none; } nav ul li a:hover::before, nav ul li a:focus::before, nav ul li a.active::before { color: #fff; text-shadow: 10px 0 #000, -10px 0 #000; } /* logo */ .logo { position: absolute; left: 50%; margin: 7px -90px 0; } .logo img { width: 75%; } .clearfix:before, .clearfix:after, .dl-horizontal dd:before, .dl-horizontal dd:after, .container:before, .container:after, .container-fluid:before, .container-fluid:after, .row:before, .row:after, .form-horizontal .form-group:before, .form-horizontal .form-group:after, .btn-toolbar:before, .btn-toolbar:after, .btn-group-vertical > .btn-group:before, .btn-group-vertical > .btn-group:after, nav:before, nav:after, .nav:before, .nav:after, .navbar:before, .navbar:after, .navbar-header:before, .navbar-header:after, .navbar-collapse:before, .navbar-collapse:after, .pager:before, .pager:after, .panel-body:before, .panel-body:after, .modal-footer:before, .modal-footer:after { display: table; content: " "; } .clearfix:after, .dl-horizontal dd:after, .container:after, .container-fluid:after, .row:after, .form-horizontal .form-group:after, .btn-toolbar:after, .btn-group-vertical > .btn-group:after, nav:after, .nav:after, .navbar:after, .navbar-header:after, .navbar-collapse:after, .pager:after, .panel-body:after, .modal-footer:after { clear: both; }
<header> <div class="top-menu"> <nav> <ul class="nav"> <li><a class="home active">inicio</a> </li> <li><a class="services scroll">servicios</a> </li> <li><a class="aboutus">sobre nosotros</a> </li> </ul> </nav> <a class="logo"> <img src="//static.inmopaco.tk/images/logo.png"> </a> <nav> <ul class="nav"> <li><a class="home">inscripciĆ³n</a> </li> <li><a class="services">acceso</a> </li> </ul> </nav> <div class="clearfix"></div> </div> </header>