Today I have studied how JS uses the setattribute method to implement two style sheets on a page. The specific method is as follows:
Step 1: Define an ID in the element connecting to the style sheet, for example
CopyCode The Code is as follows:
But this is not conducive to plug-in transplantation, so I wrote this function to dynamically generate CSS.
CopyCodeThe Code is as follows: addcss = function (c ){
VaR sty = Document. createelement ('style ');
Sty. type = 'text/CSS ';
If
Although I have been developing Web applications for three years, I am still in a completely unknown state of CSS. The main reason is the fear of xhtml. In addition to being forced to work for a while, I chose to write data, communication, or
Common CSS naming rules
Header: header
Content: content/container
End: footer
Navigation: nav
Sidebar: sidebar
Column: column
Overall Layout width of the page peripheral control: wrapper
Left right center
Logon entry: loginbar
Logo:
In a certain area on the webpage, the style is changed when the mouse moves in, and the style is automatically restored when the mouse moves out. It can be the border of an image, or the color of a text segment, it seems that webpage interaction can
When jQuery is used to obtain the value of background-color in the style, the obtained color value is displayed in HEX format in IE10 or earlier versions [# ffff00], while IE10, chrome and Firefox display [rgb (255, 0, 0)] in GRB format. To
I. Partial style change
You can change the direct style, className, and cssText. Note that:Note case sensitivity:Javascript is case sensitive. className cannot write "N" as "n", and cssText cannot write "T" as "t". Otherwise, the effect cannot be
You can only write native JavaScript to modify CSS attributes using javascript.
1. Use JS to modify the class attribute value of a tag:
The class attribute is one of the methods for referencing a style sheet on a label. Its value is a style sheet
CSS and JS tape (.css? V = with. js? V =)
Copy codeThe Code is as follows:
There are two possibilities for using parameters,
First, the script does not exist, but is dynamically generated by the server. Therefore, a version number is provided
CSS selectors can include the tag selector, category selector, ID selector, intersection selector, Union selector, descendant selector, global selector, and pseudo class. These style applications have been supported in flex.
1. Tag SelectorThe tag
Document directory
Operate CSS using jQuery
JQuery size Method
Operate CSS using jQuery
AddClass ()-add one or more classes to the selected Element
RemoveClass ()-delete one or more classes from the selected Element
ToggleClass ()-
Query is a javascript css selector engine that is compact and powerful. It is compressed for about 2 K and can be easily integrated into the code.Support for browsers
IE6 +, Firefox, Chrome, Safari, and Opera
SelectorQuery (selector [, context])Div#
Use jquery to dynamically load js and css files
Copy codeThe Code is as follows: $. extend ({
IncludePath :'',
Include: function (file ){
Var files = typeof file = "string "? : File;
For (var I = 0; I Var name = files [I]. replace (/^ \ s | \ s
DIV + CSS + JS implements uninterrupted horizontal scrolling code
Copy codeThe Code is as follows:
div css code scrolling horizontally without interruption-DIVCSS5
DIVCSS5 demo Description: Scroll left
A project wants to use jQuery to create a DIV element that can be semi-folded, so it writes it by itself because accordion does not provide relevant methods in jQueryUI. In the past, when using jQueryUI, we found that all the accordion that can be
Copy codeThe Code is as follows:
DIV layer minimization and drag/drop sorting made by JS + CSS
& Lt; table width = "100%" & gt;
Baidu click here to drag - x
address: http://www.baidu.com
keywords:
Note:
& Lt; table
CSS allows you to move the mouse over the image and change the image. This is a result fully implemented by CSS. Of course, JavaScript can also be used. When you move the mouse over the image, the image is automatically replaced with other images,
Code attached:
Copy codeThe Code is as follows:
/* Put the specific module in this big div */
# Contentmenu1 {
Width: 100%;
Clear: both;
Height: 800px;
}
/* Specific module div
Consists of up and down two div
The above div has three rounded
Although javascript can construct objects and hide private methods as it targets objects, the demand changes more quickly than when you write programs, and the time for designing js objects is gone, therefore, I prefer to use js private functions
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.