html - DOCTYPE 打乱格式

标签 html css format

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

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

方法,以及其他方法,但遗憾的是,我无法弄清楚如何将其插入我的代码中。每次我添加 DOCTYPE ,我的背景图消失了,我也尝试了背景图的方法。

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

~Wumbo

最佳答案

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

  1. 创建单独的 CSS 文件作为 mystyle.css并将所有的 css 代码放在那里。
  2. 为您的 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 ( &#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 元素管理工具可用于使您的代码清晰易读。

关于html - DOCTYPE 打乱格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31594268/

相关文章:

html - Internet Explorer 8 在 :hover 上产生奇怪的 CSS 错误

r - 如何在命令行上将 .dat + .sps 转换为 .sav

batch-file - 我该如何修复 %%i 此时是意外的?

java - 格式化输出方式

javascript - 在 Javascript 表中添加从零开始的计数器

javascript - 选择后隐藏文件输入

html - 2 div inline 太大而不适合

javascript - 使用脚本而不是平板电脑检测手机

jquery - 如何使用滚动条查看可拖动div中的长内容?

html - 在 CSS 中为线性渐变动态设置背景 url