gpt4 book ai didi

html - <!doctype ..../> 用于 HTML5

转载 作者:太空宇宙 更新时间:2023-11-04 15:19:40 25 4
gpt4 key购买 nike

我的网页中有一些 HTML5 标签。我用过<!DOCTYPE html>对于同一个网页...但我面临一些间距问题。我试过line-height:0px; and vertical-align也...但是通过这个打开了其他一些问题...所以我不能使用 line-height:0;...

我试过改变<!DOCTYPE html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

至此,所有问题都已解决并且工作正常..:)...

我只想知道这样添加对不对

"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"

在 HTML5 页面中...它是否有效...或者我的 HTML4 标签有任何其他方法...

谢谢...

编辑....

这是一些代码。请将其保存为 html 格式,然后查看...并尝试使用 "<!DOCTYPE html" only ...你会发现不同...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<style type="text/css">

.sharecon {
border-bottom: 1px solid #E6E6E6;
float: left;
padding: 3px 0 6px;
width: 100%;
font-family:Arial; font-size:12px;
}
.dvleft {
float: left;
}
.mleft5 {
margin-left: 5px;
}
.text11 {
color: #000000;
font-size: 11px;
}
strong {
font-weight: bold;
}
</style>
</head>
<body>

<div class="sharecon">
<span class="dvleft mleft5">
<input id="abc123" type="checkbox" onclick="javascript:EmailBoxGetFocus();CheckUncheck(this,'abc@gmail.com');SetSelectedCount();EmailBoxLostFocus();" value="abc@gmail.com" name="dlstContacts$ctl00$checkBoxSpn">
</span>
<span class="dvleft mleft15" style="margin-left:4px; margin:2px;">
<strong class="text11" style="line-height: 12px">ABC Name</strong>
<br>
<span class="light_text11" style="line-height:12px;display:inline"> abc@gmail.com </span>
</span>
</div>

</body>
</html>

最佳答案

XHTML 1.0 Transitional 文档类型将许多浏览器放入 Quirks Mode ,这意味着浏览器或多或少地模拟了 IE 的灭绝版本,有许多错误和奇怪之处,或者进入 Almost Standards Mode 的故意破坏模式。 ,这是一种较少损坏的模式。使用 <!doctype html>触发标准模式,所以如果你的页面受到它的干​​扰,那是因为你的页面依赖于曾经在浏览器中常见的错误。

要说做什么并不容易。如果该页面使用 XHTML 1.0 Transitional 文档类型,那么最好保持这种状态,直到页面的下一次完整修订(重写)。如果这是一个正在创建的新页面,它应该从一开始就设计为在标准模式下工作。

请注意,使用(或不使用)doctype 与支持 HTML5 新奇事物无关。浏览器可以使用 HTML5 功能进行操作。 doctype 只是 a) 通过复杂规则选择浏览器模式的神奇字符串(主要影响 CSS 应用的正确程度)和 b) 如果您使用标记验证器,则用于指定要应用的语法规则的工具。

关于html - &lt;!doctype ..../> 用于 HTML5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14727590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com