JavaScript CSS Style屬性對(duì)照表
發(fā)布時(shí)間:2010-01-18 00:02:30 作者:佚名
我要評(píng)論
為了達(dá)到某種特殊的效果我們需要用Javascript動(dòng)態(tài)的去更改某一個(gè)標(biāo)簽的Css屬性。
比如:鼠標(biāo)經(jīng)過一個(gè)圖片時(shí)我們讓圖片加一個(gè)邊框,代碼可能是這樣:
JavaScript代碼
復(fù)制代碼
代碼如下:<script type="text/javascript">
function imageOver(e) {
e.style.border="1px solid red";
}
function imageOut(e) {
e.style.borderWidth=0;
}
</script>
<img src="phplamp.gif" onmouseover="imageOver(this)" onmouseout="imageOut(this)" />
JavaScript中style后面的屬性應(yīng)該是什么?
JavaScript CSS Style屬性對(duì)照表
| 盒子標(biāo)簽和屬性對(duì)照 | |
|---|---|
| CSS語(yǔ)法 (不區(qū)分大小寫) | JavaScript語(yǔ)法 (區(qū)分大小寫) |
| border | border |
| border-bottom | borderBottom |
| border-bottom-color | borderBottomColor |
| border-bottom-style | borderBottomStyle |
| border-bottom-width | borderBottomWidth |
| border-color | borderColor |
| border-left | borderLeft |
| border-left-color | borderLeftColor |
| border-left-style | borderLeftStyle |
| border-left-width | borderLeftWidth |
| border-right | borderRight |
| border-right-color | borderRightColor |
| border-right-style | borderRightStyle |
| border-right-width | borderRightWidth |
| border-style | borderStyle |
| border-top | borderTop |
| border-top-color | borderTopColor |
| border-top-style | borderTopStyle |
| border-top-width | borderTopWidth |
| border-width | borderWidth |
| clear | clear |
| float | floatStyle |
| margin | margin |
| margin-bottom | marginBottom |
| margin-left | marginLeft |
| margin-right | marginRight |
| margin-top | marginTop |
| padding | padding |
| padding-bottom | paddingBottom |
| padding-left | paddingLeft |
| padding-right | paddingRight |
| padding-top | paddingTop |
| 顏色和背景標(biāo)簽和屬性對(duì)照 | |
| CSS語(yǔ)法 (不區(qū)分大小寫) | JavaScript語(yǔ)法 (區(qū)分大小寫) |
| background | background |
| background-attachment | backgroundAttachment |
| background-color | backgroundColor |
| background-image | backgroundImage |
| background-position | backgroundPosition |
| background-repeat | backgroundRepeat |
| color | color |
| 樣式標(biāo)簽和屬性對(duì)照 | |
| CSS語(yǔ)法 (不區(qū)分大小寫) | JavaScript語(yǔ)法 (區(qū)分大小寫) |
| display | display |
| list-style-type | listStyleType |
| list-style-image | listStyleImage |
| list-style-position | listStylePosition |
| list-style | listStyle |
| white-space | whiteSpace |
| 文字樣式標(biāo)簽和屬性對(duì)照 | |
| CSS語(yǔ)法 (不區(qū)分大小寫) | JavaScript語(yǔ)法 (區(qū)分大小寫) |
| font | font |
| font-family | fontFamily |
| font-size | fontSize |
| font-style | fontStyle |
| font-variant | fontVariant |
| font-weight | fontWeight |
| 文本標(biāo)簽和屬性對(duì)照 | |
| CSS語(yǔ)法 (不區(qū)分大小寫) | JavaScript語(yǔ)法 (區(qū)分大小寫) |
| letter-spacing | letterSpacing |
| line-break | lineBreak |
| line-height | lineHeight |
| text-align | textAlign |
| text-decoration | textDecoration |
| text-indent | textIndent |
| text-justify | textJustify |
| text-transform | textTransform |
| vertical-align | verticalAlign |
相關(guān)文章

CSS3打造的現(xiàn)代交互式登錄界面詳細(xì)實(shí)現(xiàn)過程
本文介紹CSS3和jQuery在登錄界面設(shè)計(jì)中的應(yīng)用,涵蓋動(dòng)畫、選擇器、自定義字體及盒模型技術(shù),提升界面美觀與交互性,同時(shí)優(yōu)化性能和可訪問性,感興趣的朋友跟隨小編一起看看吧2025-06-20CSS普通流、浮動(dòng)與定位網(wǎng)頁(yè)布局三大機(jī)制及最佳實(shí)踐
本文給大家講解CSS 的三種核心布局機(jī)制——普通流(Normal Flow)、浮動(dòng)(Float)和定位(Positioning)對(duì)于創(chuàng)建靈活、響應(yīng)式的網(wǎng)頁(yè)至關(guān)重要,本文將深入探討這三種機(jī)制的工作原2025-06-19
css實(shí)現(xiàn)角標(biāo)效果并帶有文章或圖標(biāo)效果(完整代碼)
文章介紹如何用CSS實(shí)現(xiàn)角標(biāo)效果,通過.active類結(jié)合::after和::before偽元素,利用定位、邊框和旋轉(zhuǎn)創(chuàng)建紅色邊框與白色三角形的提示標(biāo)志,適用于按鈕或卡片元素的視覺增強(qiáng)設(shè)計(jì)2025-06-19CSS Anchor Positioning重新定義錨點(diǎn)定位的時(shí)代來臨(最新推薦)
CSS Anchor Positioning是一項(xiàng)仍在草案中的新特性,由 Chrome 125 開始提供原生支持需啟用實(shí)驗(yàn) flag,它允許你在 CSS 中通過錨點(diǎn)(anchor)來相對(duì)于任意 DOM 元素定位,本文2025-06-17CSS中的Static、Relative、Absolute、Fixed、Sticky的應(yīng)用與詳細(xì)對(duì)比
CSS 中的 position 屬性用于控制元素的定位方式,不同的定位方式會(huì)影響元素在頁(yè)面中的布局和層疊關(guān)系,以下是 static、relative、absolute、fixed、sticky 的詳細(xì)對(duì)比和應(yīng)用2025-06-17CSS place-items: center解析與用法詳解
place-items: center; 是一個(gè)強(qiáng)大的 CSS 簡(jiǎn)寫屬性,用于同時(shí)控制 網(wǎng)格(Grid) 和 彈性盒(Flexbox) 布局中的對(duì)齊方式,本文給大家介紹CSS place-items: center; 詳解與用法2025-06-17
CSS實(shí)現(xiàn)元素?fù)螡M剩余空間的五種方法
在日常開發(fā)中,我們經(jīng)常需要讓某個(gè)元素占據(jù)容器的剩余空間,本文將介紹5種不同的方法來實(shí)現(xiàn)這個(gè)需求,并分析各種方法的優(yōu)缺點(diǎn),感興趣的朋友一起看看吧2025-06-17CSS中前端單位 px、vw、vh 等的區(qū)別與使用建議
CSS單位區(qū)別與使用場(chǎng)景總結(jié):px絕對(duì)、vw/vh響應(yīng)式,%繼承父尺寸,em/rem文字縮放,vmin/vmax適應(yīng)寬高變化,固定布局用px或%,響應(yīng)式布局用vw/vh/rem,文字用em或rem,本文給大家2025-06-16CSS 樣式表的四種應(yīng)用方式及css注釋的應(yīng)用小結(jié)
這篇文章主要介紹了CSS 樣式表的四種應(yīng)用方式及css注釋的應(yīng)用小結(jié),本文通過實(shí)例代碼給大家介紹的非常詳細(xì),感興趣的朋友跟隨小編一起看看吧2025-05-21- 在CSS布局中,padding屬性是控制元素內(nèi)容與其邊框之間距離的關(guān)鍵工具,本文介紹CSS基礎(chǔ)中padding,通過本文的介紹,我們深入了解了padding的基本概念、簡(jiǎn)寫方法以及它對(duì)元2025-05-16




