HTML / CSS无法获取标题背景颜色以弹出 [英] HTML/CSS Cannot get header background color to pop up
本文介绍了HTML / CSS无法获取标题背景颜色以弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<!doctype html>
<html>
<head>
<title> Secret Of Beauty </title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/main.css"/>
</head>
<body>
<header>
<h1> Secret of Beauty</h1>
</header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Product</a></li>
<li><a href="#">Locations</a></li>
</ul>
</nav>
</body>
</html>
(保存在包含css文件夹的HTML文件夹中的索引代码,该文件夹也包含main.css)
(Index code saved within a HTML folder that contains a css folder which also contains main.css)
body {
text-align: center;
}
header {
height:100px;
background:black;
width:100px;
}
CSS CODE只有当我改变body {}部分时才有效但是当我试图弄乱标题时它什么都没做我在body {}代码中放了多种颜色,这些颜色全部起作用并填写了页面但没有什么是使用头文件
CSS CODE which only works when I alter the body {} sections but when ever I attempt to mess with the header it does nothing I put multiple colors within the body{} code which all worked and filled out the page but nothing is working with the header files
推荐答案
<style type="text/css">
body {
text-align: center;
}
header {
height:100px;
background:black;
width:100%;
}
header h1{
color:#FFF;
}
</style>
这篇关于HTML / CSS无法获取标题背景颜色以弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文