Problem with centering of h1 and nav

3

I need the h1 and the nav to be centered without spaces between them.

<h1 align= center>
<img src= Imagenes\header.jpg>
</h1>
</div>
    <span class="fuente-1"> 
    <div class="inner">
    <nav> 
    <ul>
    <li><a href=”A”>Inicio</a></li>
    <li><a href=”A”>Modelos</a></li>
    <li><a href=”A”>Social</a></li>
    <li><a href="A">Contacto</a></li>
    </ul>

    </div>
    </nav>


<style type="text/css">


    body{
        background-color:#000000;
    }

nav {
    width: 100%;
    background: #000000;
    padding: 0;

}

nav ul {
    overflow: hidden;
    margin: 20%;
    padding: 0;
}

nav ul li {
    list-style: none;
    float: left;
    text-align: center;
    /*border-left: 3px solid #fff;
    border-right: 3px solid #ccc;*/
    width: 25%; /* fallback for non-calc() browsers */
    box-sizing: border-box;
}

nav ul li a {
    display: block;
    text-decoration: none;
    color: #FFFFFF;
    padding: 10;
}

    .inner {
        width: 100%;
        /*max-width:960px;*/
        margin:0 auto;
        padding-bottom: 0px;
        padding-top: 0px;
        font-size: 325%;
        text-align: center;

    }


    @font-face 
    {
    font-family: "BebasNeue";
    src: url(Fuentes/BebasNeue.otf) format("opentype");
    }

    .fuente-1 
    {
    font-family: "BebasNeue"
    }



</style>
    
asked by Nahuel Palacios 13.06.2016 в 22:05
source

1 answer

0

The problem is that in the style nav ul that you are using you have defined a general margin, that is to say margin: 20%;

You can change that for the following:

nav ul {
    overflow: hidden;
    margin: 0;
    padding: 0;
}

or if you want to use custom margins, use the margins individually:

nav ul {
    overflow: hidden;
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
    padding: 0;
}

body{
  background-color:#000000;
}

nav {
    width: 100%;
    background: #000000;
    padding: 0;

}

nav ul {
    overflow: hidden;
    margin: 0;
    padding: 0;
}

nav ul li {
    list-style: none;
    float: left;
    text-align: center;
    /*border-left: 3px solid #fff;
    border-right: 3px solid #ccc;*/
    width: 25%; /* fallback for non-calc() browsers */
    box-sizing: border-box;
}

nav ul li a {
    display: block;
    text-decoration: none;
    color: #FFFFFF;
    padding: 10;
}

    .inner {
        width: 100%;
        /*max-width:960px;*/
        margin:0 auto;
        padding-bottom: 0px;
        padding-top: 0px;
        font-size: 325%;
        text-align: center;

    }


    @font-face 
    {
    font-family: "BebasNeue";
    src: url(Fuentes/BebasNeue.otf) format("opentype");
    }

    .fuente-1 
    {
    font-family: "BebasNeue"
    }
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  
  <h1 align= center>
<img src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRL999as0iqLTWN93dvmdmL83hlDa3kgx0ot-GYFec9OYWgZiqi5A">
</h1>
</div>
    <span class="fuente-1"> 
    <div class="inner">
    <nav> 
    <ul>
    <li><a href="#">Inicio</a></li>
    <li><a href="#">Modelos</a></li>
    <li><a href="#">Social</a></li>
    <li><a href="#">Contacto</a></li>
    </ul>

    </div>
    </nav>

</body>
</html>
    
answered by 13.06.2016 / 22:21
source