2017-08-30 2 views
1

J'ai essayé toutes les combinaisons possibles de solutions fournies pour se débarrasser de cette marge comme:Css - Marge blanche sur ma page web

body {  
    margin: 0 !important; 
    padding: 0 !important; 
} 

et

* { 
    margin: 0px; 
    padding: 0px; 
} 

et

* { 
     margin: 0; 
     padding: 0; 
     border: 0; 
     outline: 0; 
     font-size: 100%; 
     vertical-align: baseline; 
     background: transparent; 
    } 

mais cela ne va pas aider. En fait, j'ai essayé presque toutes les solutions raisonnablement sonnant de la question de stackoverflow du top 5 sur mon sujet et n'ai toujours eu aucun résultat. Ma page web est:

<!DOCTYPE html> 
<html> 
<head> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <title>My Page Title</title> 
    <link rel="stylesheet" href="css/normalize.css"> 
    <link rel="stylesheet" href="css/style.css"> 
</head> 
<body> 


    <header class="main-header"> 
     <h1 class="name"><a href="#">Header text here</a></h1> 
    </header> 

et le CSS est:

body { 
    line-height: 1.6; 
    color: #3a3a3a; 
    font-family: "Arial", sans-serif; 
} 

a { 
    color: #fff; 
    text-decoration: none; 
} 

.main-header { 
    background: #3acec2; 
} 

J'utilise la version 7.0 Normaliser à jour sur 30,08.

+0

Pouvez-vous fournir le code de travail de bout ..? –

+0

pouvez-vous joindre une capture d'écran de votre problème ou jsfiddle? –

+0

La marge provient de l'élément 'h1' – sol

Répondre

0

Enlever h1 margin-top et la marge de body.

body { 
 
    line-height: 1.6; 
 
    color: #3a3a3a; 
 
    font-family: "Arial", sans-serif; 
 
    margin:0; 
 
} 
 
a { 
 
    color: #fff; 
 
    text-decoration: none; 
 
} 
 
.main-header { 
 
    background: #3acec2; 
 
} 
 
.main-header h1 { 
 
    margin-top: 0; 
 
}
<!DOCTYPE html> 
 
<html> 
 
<head> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 
    <title>My Page Title</title> 
 
    <link rel="stylesheet" href="css/normalize.css"> 
 
    <link rel="stylesheet" href="css/style.css"> 
 
</head> 
 
<body> 
 
<header class="main-header"> 
 
    <h1 class="name"><a href="#">Header text here</a></h1> 
 
</header> 
 
</body> 
 
</html>