有人可以解释.... [英] Can someone please explain....

查看:72
本文介绍了有人可以解释....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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的整体概念。这只不过是用于描述样式的声明性语言。您可能需要了解声明性语言:

http://en.wikipedia.org/wiki / Declarative_programming [ ^ ]。



即使某些声明性语言可能描述类似命令之类的东西,CSS也不会发生这种情况。当浏览器加载一些HTML文件时,它会加载所有CSS代码,无论它是否都嵌入在该HTML中,或者引用了单独的文件(资源)。重要的是要明白只发生一次。从CSS读取的样式属性放在HTML DOM中,最终定义HTML的呈现。可以通过Javascript访问DOM并进行修改。在HTML或CSS文件中编写的CSS代码中没有任何动态;它仍然是固定的。当您动态修改,添加,删除或替换HTML元素的样式时,您可以对DOM执行此操作;并且所有这些更改会立即更改页面的呈现。



请参阅: http://en.wikipedia.org/wiki/Document_Object_Model [ ^ ],

http://www.w3schools.com/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:
http://en.wikipedia.org/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: http://en.wikipedia.org/wiki/Document_Object_Model[^],
http://www.w3schools.com/js/js_htmldom_css.asp[^] (you can find very basic explanation of changing styles here).

—SA


这篇关于有人可以解释....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆