JavaScript CSS Style属性对照表

  发布时间:2010-01-18 00:02:30   作者:佚名   我要评论
为了达到某种特殊的效果我们需要用Javascript动态的去更改某一个标签的Css属性。

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

JavaScript代码

复制代码
代码如下:

<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后面的属性应该是什么?
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

相关文章

  • CSS3 实现文本与图片横向无限滚动动画效果

    这篇文章主要介绍了CSS3 实现文本与图片横向无限滚动动画,本文通过示例代码给大家介绍的非常详细,感兴趣的朋友跟随小编一起看看吧
    2024-06-12
  • CSS实现苹果官网文字渐入效果(示例代码)

    这篇文章主要介绍了CSS实现苹果官网文字渐入效果(示例代码),文字是从左到有慢慢呈现出来,不是整体消失和出现,那么肯定不能使用透明度,结合示例代码讲解的非常详细,需要
    2024-06-12
  • CSS实现鼠标悬停图片放大的多种方法

    这篇文章主要介绍了CSS实现鼠标悬停图片放大的几种方法,使用css设置背景图片大小100%,同时设置位置和过渡效果,然后使用:hover设置当鼠标悬停时修改图片大小,实现悬停放
    2024-05-29
  • css3实现类似地图定位循环扩散光圈效果(最新推荐)

    这篇文章主要介绍了css3实现类似地图定位循环扩散光圈效果,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友跟随小编一起看看吧
    2024-05-24
  • CSS鼠标悬浮动画-hover属性详解

    这篇文章主要介绍了CSS鼠标悬浮动画-hover属性详解,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友跟随小编一起看看吧
    2024-05-24
  • CSS的Flexbox布局示例详解

    CSS Flexible Box Module是一种现代化的布局模式,用于创建响应式的一维布局(无论是水平还是垂直),下面给大家介绍Flexbox布局的一些关键概念和示例代码,感兴趣的朋友一
    2024-05-16
  • CSS中去掉li前面的圆点方法(常见方法汇总)

    在网页开发中,我们经常会使用无序列表(<ul>)来展示一系列的项目,默认情况下,每个列表项(<li>)前面都会有一个圆点作为标记,本文将介绍几种常见的方法来
    2024-05-16
  • CSS实现dom脱离文档流定位固定位置的操作代码

    在CSS中,要使一个DOM元素脱离正常的文档流并定位在页面的右顶部,你可以使用position属性,这篇文章主要介绍了CSS实现dom脱离文档流定位固定位置,需要的朋友可以参考下
    2024-04-30
  • stylus入门使用方法示例详解

    Stylus 是一个功能强大的 CSS 预处理器,能够让你的样式表开发变得更加高效和有趣,本文介绍stylus入门使用方法,感兴趣的朋友跟随小编一起看看吧
    2024-04-22
  • CSS中五种常见定位方式详解

    这篇文章主要为大家详细介绍了CSS中五种常见定位方式以及它们的具体应用,文中的示例代码讲解详细,具有一定的借鉴价值,感兴趣的小伙伴可以跟小编一起学习一下
    2024-04-22

最新评论