大家好我嘗試通過繼承使我所有的頁面字體大小爲16px,但h1,h2和h3無法繼承它,也請隨時檢查我的代碼是否有任何其他事情我做錯了,請建議您找到更合適的更改。感謝幫助。未能繼承
這裏是我的片斷:
body {
font-family: sans-serif;
font-size: 16px;
font-weight: normal;
}
/*************************HEADER*****************************************/
header {
background-color: burlywood;
display: flex;
flex-direction: column;
padding-left: 20px;
}
.header {
margin: 0px;
}
#login {
background-color: red;
align-self: flex-end;
margin-right: 20px;
display: flex;
flex-direction: column;
align-items: flex-end;
}
h3 {
align-self: flex-end;
}
#menuList {
list-style-type: none;
margin: 0px;
display: flex;
flex-direction: row;
justify-content: flex-end;
padding-right: 20px;
}
.menuListItem {
display: inline-block;
margin-right: 15px;
}
/*************************SECTION****************************************/
section {
background-color: crimson;
display: flex;
flex-direction: row;
}
/*************************FOOTER*****************************************/
footer {
background-color: indianred;
display: flex;
flex-direction: column;
}
<!Doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="test-style.css" />
</head>
<body>
<!-------------------------------HEADER------------------------------------------------------>
<header>
<h1 class="header">Bienvenue</h1>
<h2 class="header">Achat et Vente</h2>
<form id="login" class="header" method="post" action="engine.php">
<div id="emailContainer"><label for="email">E-mail</label><input type="email" name="email" id="email" /></div>
<div id="passContainer"><label for="pss">Mot de passe</label><input type="password" name="pass" id="pass" /></div>
</form>
<h3 class="header"><span><a href="#">Connexion</a><span> ou <span><a href="#">Créer un compte</a></span></h3>
<nav class="header" id="MenuBar">
<ul id="menuList">
<li class="menuListItem">Acceuil</li>
<li class="menuListItem">Categorie</li>
<li class="menuListItem">Service</li>
<li class="menuListItem">Contact</li>
</ul>
</nav>
</header>
<!-------------------------------SECTION----------------------------------------------------->
<section>
<nav id="navInSection">
<ul id="navList">
<li>Acceuil</li>
<li>Categorie</li>
<li>Service</li>
<li>Contact</li>
</ul>
</nav>
<div id="underSectionContainer" <form id="searchZone">
<label for="search">Recherche</label><input type="search" name="search" id="search" />
</form>
</div>
</section>
<!-------------------------------FOOTER------------------------------------------------------>
<footer>
<h4>Réseaux Sociaux</h4>
</footer>
</body>
<html>
謝謝Pugazh,但是身體標記中的標記不應該像繼承font-family一樣繼承字體大小嗎? – AllenWalker
@AllenWalker - 這是你的問題的答案http://stackoverflow.com/questions/35736718/css-body-properties-not-inherited-by-h1-tag – Pugazh
這個選擇h3.header是否意味着:select h3 inside頭? – AllenWalker