Difference: JavaScript is a browser client script language, used to realize the function of interaction between web pages and people; CSS is a markup language that separates style information from web page content and is used to modify web page styles. , that is, to make the web page look better. To put it simply: CSS is the performance of the web page, and JavaScript is the behavior of the web page.
The operating environment of this tutorial: Windows 7 system, CSS3&&javascript version 1.8.5, Dell G3 computer.
What is CSS?
Performance (presentation) - Design the presentation style of the web page, that is, "how to display relevant content"
CSS (Cascading Style Sheets, cascading style sheets) is the style A markup language that separates information from web content. We use CSS to define styles for each element; it is mainly used to beautify HTML pages.
The syntax is: selector {property: value}
(selector {property: value}).
You can modify the display, position and other styles of each element in the HTML document by setting the corresponding style attributes; such as modifying the color, font, font size, width and height, position, background, etc.
CSS is mainly used To design the style of web pages and beautify web pages; it can not only statically modify web pages, but also dynamically format various elements of web pages in conjunction with various scripting languages.
CSS can perform pixel-level precise control over the layout of element positions in web pages, supports almost all font size styles, and has the ability to edit web page objects and model styles. [Recommended tutorial: CSS video tutorial]
What is JavaScript?
Behavior - Control the behavior (effect) of the web page, that is, "how the content should react to events"
JavaScript is an advanced, The interpreted and literal scripting language is a prototype-based, function-first language. It is a multi-paradigm language that supports object-oriented programming, imperative programming, and functional programming.
Using JavaScript code can make the front desk interactive (click events). It is often used to add various dynamic functions to web pages and provide users with a smoother and more beautiful browsing effect. Usually JavaScript scripts realize their functions by embedding them in HTML. [Related tutorial recommendations: JavaScript video tutorial]
Commonly used functions of JavaScript:
1. Embed dynamic text in HTML pages
2. Respond to browser events
3. Read and write HTML elements
4. Verify data before the data is submitted to the server
5. Detect visitors Browser information
6. Control cookies, including creation and modification.
The difference between css and javascript
CSS is Web page performance and JS are web page behaviors.
Client web pages usually include web content, HTML, javascript and CSS. Let me give you a common analogy:
HTML is like a human skeleton, forming the basic framework of a web page
CSS is like a person’s skin and appearance , depicts the appearance of a web page
And javascript is like human muscles, making web pages interactive
CSS, cascading style sheets, are used Modifying the style of a web page means making the web page look better; and javascript is a browser client-side scripting language that is used to realize the function of interaction between web pages and people.
css statically modifies the web page so that the page can be displayed in a certain layout.
CSS is a markup language that separates style information from web page content. We use css to define styles for each element; it is mainly used to beautify HTML pages.
JS handles various dynamic effects on the page and can be used to realize the functions of interaction between web pages and people, such as replacing pictures, scrolling pictures, displaying and hiding layers, processing shortcut keys, etc. .
For more programming related knowledge, please visit: Programming Video! !
The above is the detailed content of what is the difference between css and javascript. For more information, please follow other related articles on the PHP Chinese website!