Set CSS attributes in Javascript

Source: Internet
Author: User

1. Transparency:

If you do not specify a background color or a background image for a text, the background of this element is usually transparent.

This is important, if an absolutely positioned element with text is placed on a text element, it will be very confusing. Then we can set a background image or background color to cover it, if necessary, you can set it to transparent " (transparent)

General settings for Transparent Elements CSS as follows:

opacity: . 75 ; /// FF new

- Moz - opacity :. 75 ; // Transparency for older extends illas

filter: alpha (opacity = 75 ); // for IE

2. CSS with a hyphen:

 

Camel naming:

Element. style. fontfamily="Sans-Serif ";

Element. style. borderleftwidth="5px ";

Element. style. zindex= 100;

 

3 Note:

Code VaR Padding_left =   50 ;
Element. style. Left = Padding_left + "PX "; // Do not forget to add units

VaR Topmargin =   10 , Rigntmargin =   11 , Bottommargin =   12 , Leftmargin =   13 ;
Element. style. Margin = Topmargin + "PX" + Rigntmargin + "PX" + Bottommargin + "PX" + Leftmargin + "PX ";

4. Set float

Element.style.css float = "Left "; // Firefox Chrome Opera
Element. style. stylefloat = "Left "; // IE

 


 







Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.