DOCTYPE 打乱格式

DOCTYPE messes up formatting

我知道很多人在切换到 <!DOCTPYE html> 线路时都会遇到类似的问题,但是,我已经尝试了所有的方法,甚至是经典的

html{height: 100%;} body {min-height: 100%;}

方法,以及其他方法,但遗憾的是,我不知道如何将其插入我的代码中。每次我添加DOCTYPE,我的背景图片都会消失,我也尝试了背景图片的方法。

这是我的代码- http://pastebin.com/554Mctvx 我希望仍然有一个中心div。 希望大家帮忙:D

~Wumbo

根据 W3C 标准,将 <!DOCTYPE html> 放在 html 文件的顶部。

  1. 创建单独的 CSS 文件作为 mystyle.css 并将所有 css 代码放在那里。
  2. 为您的 css 文件创建一个 link,例如 <link rel="stylesheet" type="text/css" href="mystyle.css">

::-moz-selection {
    color: #ffffff;
    background: #00ffaa;
}

::selection {
    color: #ffffff;
    background: #00ffaa;
}

a:link {
    color: #00ffaa;
}

/* visited link */
a:visited {
    color: #00d486;
}

/* mouse over link */
a:hover {
    color: #57ffd5;
}

/* selected link */
a:active {
    color: #00ffaa;
}
#center{
width:80%;
height:125%;
margin-right:auto;
margin-left:auto;
background-color:2d2d2d;
}
<link rel="shortcut icon" href="http://i.imgur.com/Bj3KBRt.png" type="image/x-icon" />
<title>Welcome to Wumbo's Site</title>

<body background="http://i.imgur.com/hySVC7M.png">
<div id="center">
<center>
<h1><font face="trebuchet MS" color="dbdbdb">This Site is Under Construction!</h1>
<p>In a few months, when I am finished, I will unveil this site! In the meantime,
also for updates, follow me on twitter.
<br>
I also have a Youtube channel where I upload stupid crap!</p>
<br>
<h1>MY SOCIAL NETWORKZ</h1>
<a href="https://twitter.com/BullCloaker">Twitter</a>
<br>
<a href="https://youtube.com/user/calluvdutyplayr9"> My Youtube Channel</a>
<p> I'm not sure what I'm going to do with this site,
<br>
But it will most likely be a portfolio, where I share all the drawings,
<br>
animations and other such things I've made.
<br>
Seeya!
<br>
<font face="trebuchet MS" color="#00ffaa"> ~Wumbo ( &#865;&#176; &#860;&#662; &#865;&#176;)</font>
</font>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<font face="Arial" color="#00ffaa" size="1">You are currently using the Dark Site Skin.<a href="file:///C:/Users/jeanpaul/Desktop/Websites/SiteLight.html">Click Here to use the Light Site Skin</a>
<br>
<br>
<br>
<a href="file:///C:/Users/jeanpaul/Desktop/Websites/AboutPageDark.html">About</a>  &#8226;  <a href="https://google.com">Gallery</a>  &#8226;  <a href="https://google.com">Videos</a>  &#8226;  <a href="file:///C:/Users/jeanpaul/Desktop/websites/SiteDark.html">Main</a>
</center>
</div>

** 尝试按照一些标准教程来管理您的 html、css 代码。这不会是一团糟。现在有很多 html/css 项目管理工具可用于使您的代码清晰易读。