gpt4 book ai didi

html - css的级联顺序

转载 作者:行者123 更新时间:2023-12-05 08:05:35 25 4
gpt4 key购买 nike

<!DOCTYPE html>
<html>
<head>
<style>
img {
width:100%;
}
</style>
</head>
<body>

<img src="html5.gif" alt="HTML5 Icon" style="width:128px;height:128px;">
<img src="html5.gif" alt="HTML5 Icon" width="128" height="128">

</body>
</html>

嗨,我有一个问题,为什么 <style>覆盖 <img src="html5.gif" alt="HTML5 Icon" width="128" height="128"> .对于订单,内联元素是否比文档级别更高??

最佳答案

参见 the CSS2 specification :

The UA may choose to honor presentational attributes in an HTML source document. If so, these attributes are translated to the corresponding CSS rules with specificity equal to 0, and are treated as if they were inserted at the start of the author style sheet. They may therefore be overridden by subsequent style sheet rules. In a transition phase, this policy will make it easier for stylistic attributes to coexist with style sheets.

关于html - css的级联顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64196959/

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