Search code examples
htmlcssresponsive-design

Why is my title (titulo) not aligned? Justify and align are not working?


I am trying to center my title "Scream" This is how it´s loooking https://codepen.io/luciajv/pen/dyaPNwB

I dont understand why the title (titulo) is not aligen after using both justify, align, and text align. I cant find my error. I tried it on a different project and it worked perfectly fine. Any help or tip will be appreciated. Thank you!

I tried CCS code:

*{
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Saira Condensed', sans-serif;
    font-size: 40px;
    
    
  }
                                                            /* TITULO */
  .titulo {
    background-color: #ffffff;
    text-align: center;
    color: rgb(0, 0, 0);
    padding: 50px;
    justify-content: center;
    display: flex;
    align-items: center;
  
  }
  
                                                          /* NAVEGADOR */
.navegador {
    background-color: #ffffff;
    padding: 10px;
    text-align: center;
}
                                                                                                        
.navegador ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
                                                                                                        
.navegador li {
    display: inline-block;
    margin: 0 20px;
}
                                                                                                        
.navegador a {
    text-decoration: none;
    color: #000000;
    font-weight: bold;
    font-size: 30px;
    transition: all 0.3s;
    display: inline-block;
    padding: 10px 20px;
}
                                                                                                        
.navegador a:hover {
    color: #ffffff; 
    transform: scale(1.1);
    background-color: #000000; 
    clip-path: circle(50% at 50% 50%); 
}

HTML code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SCREAM</title>
    <link href="style.css" rel="stylesheet" type="text/css"/>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Saira+Condensed:wght@100&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
    
    <section id="titulo">
        <h1>SCREAM</h1> 
    </section>

    <main id="volver">  
        <header class="header">
             <ul class="navegador">
                <li><a href="#productos">Productos</a></li>
                <li><a href="#nosotros">Nosotros</a></li>
                <li><a href="#categorias">Categorias</a></li>
                <li><a href="#sumate">Sumate</a></li>
              </ul>
          </nav>
    </header>

</body>
</html>

Solution

  • You're super close. Your HTML indicates this should be an ID not a class.

    In your CSS, just change:

    .titulo
    

    to:

    #titulo