分区标头

时间:2018-02-19 16:16:18

标签: html css

我想在div的标题部分使用 hello world 但是当我使用p标记将其写入分区时,文本不会出现在我做的标题部分反而出现在它下面。

Webpage

样式表代码:

body{
	background-image: url("back.jpg");
}

.main{
	height:100%;
	width:1100px;
	margin-left:6%;
	background-color:white;
}
.header{
	height:20%;
	width:1100px;
	background-image: url("head.jpg")
}
.logo{
	height:100%;
	width:250px;
	background-image: url("head.jpg");
	float:left;
}
.menu{height:7%;
	width:1100px;
	background-color:gray;
}
.content{
	height:63%;
	width:1100px;
}

.footer{height:10%;
	width:1100px;
	background-color:maroon;
}
#logoimage{
		height:100%;
}
h1{
	color:white;
}
HTML网页代码

<html>
	<head>
		<link rel="stylesheet" type="text/css" href="Stylesheet.css">
		<title></title> 
		
	</head>
	
	<div class="main">
			<div class="header">
				<div class="logo">
					<img src="logo.png" alt="Sorry for the inconvenience" id="logoimage">
					<h1> Hello World </h1>
				</div><!--Logo ends here-->
			</div><!--Header ends here-->
				<div class="menu">
			</div><!--Menu bar ends here-->
			<div class="content">
			</div>
			<div class="footer">
			</div><!--Footer ends here-->
	</div><!--Body ends here-->
	
	
	
	</body>
</html>

2 个答案:

答案 0 :(得分:0)

您的Hello World确实显示在页面上...您无法看到它的原因,是因为您的字体颜色设置为白色,此处:

h1{
    color:white;
}

将其更改为其他颜色,您应该能够看到它Working Fiddle

p代码

中有working fiddle Hello World

答案 1 :(得分:0)

没关系,我能够解决我的问题。谢谢@Rushikumar的答复,实际上我无法在div的标题部分显示我的hello世界我做了我在div的logo部分插入文本。抱歉,因为这个愚蠢的错误,我发了一个论坛帖子。

相关问题