我知道很多人在切换到 <!DOCTPYE html>
时遇到类似的问题行,然而,我已经尝试了所有的方法,甚至是经典的
html{height: 100%;}
body {min-height: 100%;}
方法,以及其他方法,但遗憾的是,我无法弄清楚如何将其插入我的代码中。每次我添加 DOCTYPE
,我的背景图消失了,我也尝试了背景图的方法。
这是我的代码- http://pastebin.com/554Mctvx 我希望仍然有一个中心 div。 希望大家帮忙:D
~Wumbo
最佳答案
放<!DOCTYPE html>
在你的顶部 html
根据 W3C 标准的文件。
- 创建单独的 CSS 文件作为
mystyle.css
并将所有的 css 代码放在那里。 - 为您的 css 文件创建一个链接,如
<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 ( ͡° ͜ʖ ͡°)</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> • <a href="https://google.com">Gallery</a> • <a href="https://google.com">Videos</a> • <a href="file:///C:/Users/jeanpaul/Desktop/websites/SiteDark.html">Main</a>
</center>
</div>
** 尝试遵循一些标准教程来管理您的 html、css 代码。这不会是一团糟。现在有很多 html/css 元素管理工具可用于使您的代码清晰易读。
关于html - DOCTYPE 打乱格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31594268/