HTML和浮点数的间距问题

时间:2015-09-01 08:07:25

标签: html css

这里的第一次海报。我一直在研究我的HTML和CSS,我遇到了一些小问题。

如果您查看链接,那么您可以看到粉红色的“我的游戏生活”和梅花色的“我缺乏宗教”之间的一些不需要的间距。那两段的id是正确的,我把它们设置为浮动:就这样; Options +FollowSymLinks RewriteEngine On RewriteCond %{QUERY_STRING} !(?:^|&)post= [NC] RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.+)$ http://%{HTTP_HOST}?post=$1 [L,R=302,QSA] 我对左侧的元素做了同样的事情:

#right {float:right;}

我将列出以下代码的完整列表和网站图片:

CSS:

#left {float:left;}

HTML:

p {
    font-size: 2em;
    font-family: "Poiret One", cursive;
    color: #D6EBFF;
}
ul {
    border:0.2em solid #1f2f31;
    border-radius: 10px;
    background-color: rgba(123, 321, 78, .2);
    padding-right: 5ps;
}
li {
    font-size: 2em;
    font-family: "Poiret One", cursive;
    color: #D6EBFF;
}
h1, h2, h3, h4, h5, h6 {
    font-size: 2em;
    font-family: "Poiret One", cursive;
    color: #D6EBFF;
}
#span1 {
    text-decoration: underline; 
}
#hello {
    margin-top: 1em;
    font-size: 3em;
}
#wonder {
    font-family: "Poiret One", cursive;
    font-weight: bold;
    font-size: 2.5em;
}
#mystery {
    font-size: 2em;
    font-family: "Dancing Script", cursive;
    padding-bottom: 5px;
    margin-bottom: 15px;
}
.intro {
    background-color: rgba(240,230,140, 0.8);
}
.intro p {
    color: #000029;
}
#img1 {
    width: 75px;
    height: 75px;
    margin-right: 2px;
    margin-bottom: 5px;
}
.img_header {
    /*float: left;*/
    border: 2px solid #1f2f31;
    border-radius: 10px;
    background-color: rgba(255,69,0,0.3);
    width: 24%;
}
.img_header_container h3 {
    padding: 15px;
    margin-top: -15px;
    margin-bottom: -2px;
}
.picture {
    margin-left: 5px;
    margin-bottom: 5px;
}
.center {
    display: table;
    margin: auto;
}
.main_container {
    border:0.2em solid #1f2f31;
    border-radius: 10px;
    background-color: rgba(157, 139, 178, .5);
}
.main_container p {
    padding-left: 10px;
}
.list {
    width: 24%;
    /*float: left;*/
}
.img_header {
    width: 24%;
}
.main_content {
    /*float:right;*/
    width: 73%;
    border:0.2em solid #1f2f31;
    border-radius: 10px;
    margin-right: 10px;
    margin-top:17px;
    background-color: rgba(205, 120, 200, .5);
    margin-bottom: 5em;
}
.main_content_container {
    text-align: center;
    padding-bottom: 10px;
}
.main_content_container p {
    font-size: 1.5em;
    line-height: 170%;
    text-align: left;
    padding-left: 10px;
}
.main_content_container a {
    font-size: 2em;
    color: #D6EBFF;
}
.religion {
    /*float:right;*/
    width: 73%;
    border:0.2em solid #1f2f31;
    border-radius: 10px;
    margin-right: 10px;
    margin-top:17px;
    background-color: rgba(103, 0, 124, .5);
    margin-bottom: 5em;
}
.religion_container {
    text-align: center;
    padding-bottom: 10px;
}
.religion_container {
    font-size: 1.5em;
    line-height: 170%;
    text-align: left;
    padding-left: 10px;
}
.religion_container a {
    font-size: 2em;
    color: #D6EBFF;
}
#left {
    float: left;
}
#right {
    float: right;
}
body {
    background-image: url("http://orig01.deviantart.net/064f/f/2010/064/6/1/arcane_symbols_by_stinkmeaner.jpg");
    background-color: black;
    font-size: 100%;
}

你有线索吗?

4 个答案:

答案 0 :(得分:3)

  • Id 必须是唯一的。您不能拥有多个“正确”div。如果应将相同的样式应用于多个元素,则它应该是一个类。对于身份img1

  • 也是如此
  • <div class="font_links">没用,因为<link>标签未显示。

  • 您使用margin-bottom: 5em代替({1}}

http://jsfiddle.net/29tz5efb/

答案 1 :(得分:1)

你的.main_content有margin-bottom: 5em;,导致它向下移动

答案 2 :(得分:1)

ID s只能与单个元素一起使用;如果您打算将特定样式应用于多个元素,则应使用

间距问题是由 .main_content 引起的 - 1. git add . 2. git pull origin master 3. git commit -am "Init commit" 4. git push origin master 会产生一个5em(大小是&#39; M&#39;无论你使用什么字体大小)你的粉红色和梅色段落之间的差距。

答案 3 :(得分:0)

删除margin-bottom:5em;在.main_content

相关问题