【发布时间】:2017-02-24 09:35:40
【问题描述】:
当我将文本放入 div 时,我得到一个空白。如何删除它?我也想问一下如何让“welkom op dennis website”这个文本自动居中在div的中间。
这里你可以看到代码:
.container {
max-width: 100%;
max-width: 100%;
margin: 0;
padding: 0;
display: inline-block;
}
html,
body {
margin: 0px;
padding: 0px;
}
.nav {
height: 5%;
width: 100%;
background-color: white;
}
.top {
height: 40%;
width: 100%;
background-color: #1E90FF;
}
.nav {
background-color: #444;
}
.nav a {
display: inline-block;
background-color: #444;
font-family: Arial;
padding: 10px 20px;
text-decoration: none;
color: white;
float: right;
}
.nav a:hover {
background-color: #1E90FF;
}
.logo {
color: white;
display: inline-block;
padding: 10px 20px;
font-family: Arial;
text-decoration: none;
}
p.center {
padding: 150px 550px;
color: white;
font-family: Arial;
font-size: 25px;
{}
<header>
<title>Dennis Zwart Home Pagina</title>
<link href="css/MyStyle.css" rel="stylesheet" style="css" />
</header>
<body>
<div class="container">
<div class="nav">
<text class="logo">Dennis Zwart</text>
<a href="#">Contact</a>
<a href="#">Games</a>
<a href="#">Foto's</a>
<a href="#">Hobby's</a>
<a href="#">Home</a>
</div>
<div class="top">
<p class="center">Welkom op de website van Dennis Zwart</p>
</div>
</div>
</body>
【问题讨论】:
-
文字不是已经居中了吗?
-
是的,但我正在寻找一种更简单的方法^^
-
我必须为学校制作自己的网站,我更好地学习它
-
你也需要垂直居中的文本吗?