有人可以解释....

编程入门 行业动态 更新时间:2024-10-22 20:34:32
本文介绍了有人可以解释....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

CSS命令如何与标签的样式属性交互?

how CSS commands interact with style properties of tags?

推荐答案

当您需要有关基本概念的信息时,请尝试 google [ ^ ]首先。有很多不同的教程可以解释它。祝你好运! When you need info on a basic concept, try google[^] first. There are a lot of different tutorials that can explain it. Good luck!

请看我对这个问题的评论。您可能无法理解CSS的整体概念。这只不过是用于描述样式的声明性语言。您可能需要了解声明性语言: en.wikipedia/wiki / Declarative_programming [ ^ ]。 即使某些声明性语言可能描述类似命令之类的东西,CSS也不会发生这种情况。当浏览器加载一些HTML文件时,它会加载所有CSS代码,无论它是否都嵌入在该HTML中,或者引用了单独的文件(资源)。重要的是要明白只发生一次。从CSS读取的样式属性放在HTML DOM中,最终定义HTML的呈现。可以通过Javascript访问DOM并进行修改。在HTML或CSS文件中编写的CSS代码中没有任何动态;它仍然是固定的。当您动态修改,添加,删除或替换HTML元素的样式时,您可以对DOM执行此操作;并且所有这些更改会立即更改页面的呈现。 请参阅: en.wikipedia/wiki/Document_Object_Model [ ^ ], www.w3schools/js/js_htmldom_css .asp [ ^ ](你可以找到这里改变风格的非常基本的解释。
-SA
Please see my comment to the question. It's possible that you don't understand the whole idea of CSS. This is nothing more than the declarative language used to describe styles. You may need to get the idea of declarative languages: en.wikipedia/wiki/Declarative_programming[^]. Even though some declarative language may describe something like "commands", nothing like that happens with CSS. When the browser loads some HTML file, it loads all the CSS code, no matter if it is all embedded in that HTML or separate files (resources) are referenced. It's important to understand that it happens only once. The style properties read from CSS are put in HTML DOM which ultimately defines the rendering of HTML. One can access DOM via Javascript and modify it. There is nothing dynamic in the CSS code written in HTML or CSS files; it remains fixed. When you dynamically modify, add, remove or replace styles of an HTML element, you do it to DOM; and all those changes immediately change the rendering of the page. Please see: en.wikipedia/wiki/Document_Object_Model[^], www.w3schools/js/js_htmldom_css.asp[^] (you can find very basic explanation of changing styles here).
—SA

更多推荐

有人可以解释....

本文发布于:2023-06-13 09:38:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/679054.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!