文字"包装本身"而不是在线显示

时间:2014-08-07 16:55:00

标签: html css text paragraph

文字是"包装自己"而不是在线显示。我曾尝试使用p {display:in-line;}但这并没有做任何事情。几乎一个字接着出现在之前的单词之下。我想知道为什么?请帮助,谢谢! (我使用谷歌的字体,但我不希望改变这种情况)

<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="aboutme.css">
<title>It's all about me!</title>
</head>
<body>
<header>
<div class="grow">
<ul>
  <li><a href="index.html">Home</a></li>
  <li><a href="aboutme.html">About me</a></li>
  <li><a href="like.html">What I love</a></li>
</ul>
</div>
</header>
<h1>About Me<h1>
<p>Hi, welcome to my website. I am not sure why this is not working at the moment.</p>
</body>
</html>

------------------------------------另一个文件中的CSS ------- -----------------------

body {
    background-image: url(magical.jpg);
}
h1 { font-family: 'Lobster', cursive;

    color: white;
    position: absolute;
    top: 200px;
    left: 630px;
    text-decoration: underline;
}
p { font-family: 'Lobster', cursive;
    font-size: 20px;
    color: white;
    position: absolute;
    top: 60px;
    right:350px;
    display: inline;

}
.grow {
    position: absolute;
    left: 550px;
    top: 700px;
}


a {
    color: black;
    text-decoration: none;
    font-weight: bold;
}
ul {
    padding: 10px;
    background: #dcf3ff;
    border-width: 6px;
    border-style: solid;
    border-color: white;

}

li {
    display: inline;
    padding: 0px 15px 0px 15px;
    border-right: 2px solid black;
    border-left: 2px solid black;

}

.grow {
  display: inline-block;
  -webkit-transition-duration: 0.7s;
  transition-duration: 0.7s;
  -webkit-transition-property: -webkit-transform;
  transition-property: transform;
  -webkit-transform: translateZ(0);
  -ms-transform: translateZ(0);
  transform: translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
}

.grow:hover {
  -webkit-transform: scale(1.3);
  -ms-transform: scale(1.3);
  transform: scale(1.3);
}

2 个答案:

答案 0 :(得分:1)

您的h1标签未正确关闭。变化:

<h1>About Me<h1> 

<h1>About Me</h1>

jsfiddle

答案 1 :(得分:0)

将css中的P元素更改为此。

p { font-family: 'Lobster', cursive;
font-size: 20px;
color: white;
position: absolute;
top: 60px;
right:350px;
display: inline;
white-space: nowrap;
}