JavaScript CSS Style属性对照表

  发布时间:2010-01-18 00:02:30   作者:佚名   我要评论
为了达到某种特殊的效果我们需要用Javascript动态的去更改某一个标签的Css属性。
(福利推荐:【腾讯云】服务器最新限时优惠活动,云服务器1核2G仅99元/年、2核4G仅768元/3年,立即抢购>>>:9i0i.cn/qcloud

(福利推荐:你还在原价购买阿里云服务器?现在阿里云0.8折限时抢购活动来啦!4核8G企业云服务器仅2998元/3年,立即抢购>>>:9i0i.cn/aliyun

比如:鼠标经过一个图片时我们让图片加一个边框,代码可能是这样:

JavaScript代码

复制代码
代码如下:

<script type="text/javascript">
function imageOver(e) {
e.style.border="1px solid red";
}
function imageOut(e) {
e.style.borderWidth=0;
}
</script>
<img src="http://9i0i.com/pic.php?p=phplamp.gif" onmouseover="imageOver(this)" onmouseout="imageOut(this)" />

JavaScript中style后面的属性应该是什么?
JavaScript CSS Style属性对照表
盒子标签和属性对照
CSS语法 (不区分大小写) JavaScript语法 (区分大小写)
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
 
颜色和背景标签和属性对照
CSS语法 (不区分大小写) JavaScript语法 (区分大小写)
background background
background-attachment backgroundAttachment
background-color backgroundColor
background-image backgroundImage
background-position backgroundPosition
background-repeat backgroundRepeat
color color
 
样式标签和属性对照
CSS语法 (不区分大小写) JavaScript语法 (区分大小写)
display display
list-style-type listStyleType
list-style-image listStyleImage
list-style-position listStylePosition
list-style listStyle
white-space whiteSpace
 
文字样式标签和属性对照
CSS语法 (不区分大小写) JavaScript语法 (区分大小写)
font font
font-family fontFamily
font-size fontSize
font-style fontStyle
font-variant fontVariant
font-weight fontWeight
 
文本标签和属性对照
CSS语法 (不区分大小写) JavaScript语法 (区分大小写)
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

相关文章

  • 使用CSS实现一个同态效果

    这周了解到一个新的名词,同态,同态可以理解成一种特殊形态吧,这篇文章主要为大家详细介绍了如何使用CSS实现这种同态效果,文中的示例代码讲解详细,感兴趣的小伙伴可以了
    2024-03-25
  • CSS实现渐变式圆点加载动画

    这篇文章主要为大家详细介绍了如何使用 css3 模拟一个渐变式圆点加载效果,文中的示例代码讲解详细,具有一定的借鉴价值,有需要的小伙伴可以跟随小编一起学习一下
    2024-03-22
  • CSS如何设置背景模糊周边有白色光晕(解决方案)

    想要给一个展示图片的区域底部加一个该图片的放大后的背景,并模糊 20,并增加一个黑色 0.6 透明度的遮罩,这篇文章主要介绍了CSS如何设置背景模糊周边有白色光晕(解决方案
    2024-03-20
  • CSS设置水平垂直居中的7种方法

    CSS中内容居中的方法有很多种,具体取决于您想要居中的内容是什么类型的元素以及是在什么情况下居中,这篇文章主要为大家整理了常用的7种方法,感兴趣的小伙伴可以跟随小编
    2024-03-19
  • CSS设置style属性的3种方法

    style属性可以用在HTML中大部分的标签上,本文主要介绍了CSS设置style属性的3种方法,文中通过示例代码介绍的非常详细,需要的朋友们下面随着小编来一起学习学习吧
    2024-03-15
  • CSS中隐藏元素的常见5种方法

    在CSS中隐藏元素有多种方法,这篇文章主要为大家整理了五种常见方法及其适用场景与区别,文中的示例代码讲解详细,具有一定的借鉴价值,有需要的小伙伴可以跟随小编一起学
    2024-03-15
  • CSS实现三栏布局的四种方法

    三栏布局是常见的一种页面布局方式,将页面分为左栏、中栏和右栏,这篇文中主要为大家详细介绍了CSS实现三栏布局的四种方法,文中的示例代码讲解详细,感兴趣的小伙伴可以
    2024-03-11
  • 使用CSS实现简单的翻页效果

    这篇文章主要为大家详细介绍了如何使用CSS实现简单的翻页效果,文中的示例代码讲解详细,具有一定的借鉴价值,有需要的小伙伴可以跟随小编一起学习一下
    2024-03-06
  • 使用CSS完成视差滚动效果

    在网页设计中,视差滚动效果可以为用户带来沉浸式的浏览体验,这篇文章主要为大家详细介绍了如何使用CSS完成视差滚动效果,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随
    2024-02-28
  • css中position:sticky 粘性定位详解

    粘性定位的元素是依赖于用户的滚动,在position:relative与position:fixed定位之间切换,这篇文章给大家介绍css中position:sticky 粘性定位的相关知识,感兴趣的朋友跟随小
    2024-02-28

最新评论

?


http://www.vxiaotou.com