<!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.
https://stackoverflow.com/questions/64196959/
相关文章:
reactjs - 在 useEffect Hook 中使用 axios 取消 token 时如何修
c# - 无法在启动类中注入(inject)IAntiforgery
asp.net-core - 我可以在 AspNetCore WebAPI 中将 Cancellat
javascript - 来自 firebase 的图像的 html2canvas jsPdf 访问
javascript - 如何在 React Native 中更改原生 Picker fontSiz
python - 我试图将 python 文件转换为 exe 文件,但它不起作用
python - 在嵌套/平面字符串和整数列表中查找超过 10 的最小数字