javascript設定css屬性

來源:互聯網
上載者:User

1.透明度:

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin;
color:red">如果沒有為一個文本指定一個背景顏色或者一個背景映像,那麼這個元素的背景通常是透明的。

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">這一點很重要,如果一個絕對位置的且帶有文本的元素放在一個有文本的元素之上,那麼將會十分的混亂,那麼我們就可以通過設定背景圖片或者背景顏色來進行遮蓋,如果必須的話我們可以將其顯示的設定為“transparentCalibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">”(透明的)

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">通用的設定透明元素通用的cssmso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">如下:

opacity:.75;//ff new

-moz-opacity:.75;// transparency for older Mozillas

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

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">2.帶有連字號的css:

 

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">駱駝式命名:

element.style.fontFamily  = “sans-serif”;

element.style.borderLeftWidth  =  “5px”;

element.style.zIndex = 100;

 

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">3注意的地方:

代碼var padding_left = 50;
element.style.left = padding_left + “px”;//不要忘記加單位

var topMargin = 10,rigntMargin = 11,bottomMargin = 12,leftMargin = 13;
element.style.margin = topMargin + ”px” + rigntMargin + “px” + bottomMargin + “px” + leftMargin + “px”;

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">4.設定float

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">

element.style.cssFloat = “left”;//firefox chrome opera
element.style.styleFloat = “left”;//IE

 

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">

 

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">

mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋體;mso-fareast-theme-font:
minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.