liststyletype属性说明表(如何用js给html表单设置style)

本文目录
如何用js给html表单设置style
首先,把CSS和JS标签style属性对照表了解了:
CSS 和 JavaScript 标签 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
《!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"》
《HTML》
《HEAD》
《TITLE》 New Document 《/TITLE》
《/HEAD》
《script language="javascript"》
function validate(){
if (document.all("name").value == ""){
document.all("name").style="red";//就是这里
return;
}
}
《/script》
《BODY》
《input type="text" name="name" 》
《/BODY》
《/HTML》
如何用JS来改变CSS属性
通过js来改变CSS属性,使用jQuery可以很方便的实现,像这样:
$("img").css(’border-color’,’red’);
就可以把边框颜色都变成红色。
这是针对此问题的测试页面
2、这是3张图片
***隐藏网址***
***隐藏网址***
***隐藏网址***
3、这是图片的样式,边框默认为灰色。
img{
max-width:200px;
border-color:gray;
border-width:10px;
border-style:solid;
}
4、现在通过这几行用到jQuery的代码,控制图片边框根据鼠标移入移出边框变灰和变红。
$(function(){
$("img").on(’mouseover’,function(){
$(this).css(’border-color’,’red’);
}).on(’mouseout’,function(){
$(this).css(’border-color’,’gray’);
});
});
5、效果如图
CSS样式中的列表中的里面是什么意思
1〉 type 类型 选择项目符号用的不同样式
list-style-type : disc | circle | square | decimal | lower-roman | upper-roman | lower-alpha | upper-alpha | none | armenian | cjk-ideographic | georgian | lower-greek | hebrew | hiragana | hiragana-iroha | katakana | katakana-iroha | lower-latin | upper-latin
取值:
disc : CSS1 默认值。实心圆
circle : CSS1 空心圆
square : CSS1 实心方块
decimal : CSS1 阿拉伯数字
lower-roman : CSS1 小写罗马数字
upper-roman : CSS1 大写罗马数字
lower-alpha : CSS1 小写英文字母
upper-alpha : CSS1 大写英文字母
none : CSS1 不使用项目符号
armenianl : CSS2 未支持。传统的亚美尼亚数字
cjk-ideographic : CSS2 未支持。浅白的表意数字
georgian : CSS2 未支持。传统的乔治数字
lower-greek : CSS2 未支持。基本的希腊小写字母
hebrew : CSS2 未支持。传统的希伯莱数字
hiragana : CSS2 未支持。日文平假名字符
hiragana-iroha : CSS2 未支持。日文平假名序号
katakana : CSS2 未支持。日文片假名字符
katakana-iroha : CSS2 未支持。日文片假名序号
lower-latin : CSS2 未支持。小写拉丁字母
upper-latin : CSS2 未支持。大写拉丁字母
说明:
设置或检索对象的列表项所使用的预设标记。
若 list-style-image 属性值为 none 或指定 url 地址的图片不能被显示时,此属性将发生作用。
假如一个列表项目的左外补丁( margin-left )被设置为 0 ,则列表项目标记不会被显示。左外补丁( margin-left )最小可以被设置为 30 。
仅作用于具有 display 属性值等于 list-item 的对象。如 li 对象。
注意: ol 对象和 ul 对象的 type 属性为其后的所有列表项目(如 li 对象)指明列表属性。
此属性对于 currentStyle 对象而言是只读的。对于其他对象而言是可读写的。
对应的脚本特性为 listStyleType 。
2〉 bullet image 是用相应图片代替项目符号
list-style-image : none | url ( url )
取值:
none : 默认值。不指定图像
url ( url ) : 使用绝对或相对 url 地址指定图像
说明:
设置或检索作为对象的列表项标记的图像。
若此属性值为 none 或指定 url 地址的图片不能被显示时, list-style-type 属性将发生作用。
此属性对于 currentStyle 对象而言是只读的。对于其他对象而言是可读写的。
对应的脚本特性为 listStyleImage 。
3〉 语法:list-style-position : outside | inside
取值:
outside : 默认值。列表项目标记放置在文本以外,且环绕文本不根据标记对齐
inside : 列表项目标记放置在文本以内,且环绕文本根据标记对齐
说明:
设置或检索作为对象的列表项标记如何根据文本排列。
假如一个列表项目的左外补丁( margin-left )被设置为 0 ,则列表项目标记不会被显示。左外补丁( margin-left )最小可以被设置为 30 。
仅作用于具有 display 属性值等于 list-item 的对象。如 li 对象。
注意: ol 对象和 ul 对象的 type 属性为其后的所有列表项目(如 li 对象)指明列表属性。
此属性对于 currentStyle 对象而言是只读的。对于其他对象而言是可读写的。
对应的脚本特性为 listStylePosition 。
div+css中,在Firefox下,list-style-type:none不支持吗
尊敬的用户,您好!很高兴为您答疑。
因为严格遵循W3C标准,火狐对没有该属性的元素不会是针对该属性的设定生效,其次其样式也不存在继承规则。因此您必须把隐藏换行符的样式放置到需要生效的li元素内才会生效。
希望我的回答对您有所帮助,如有疑问,欢迎继续咨询我们。

更多文章:
evaluation状态是好是坏(evaluation和review有什么区别)
2025年12月27日 22:30
idea写的代码eclipse能用吗(怎么把Intelij IDEA的工程变为Eclipse工程,希望有人解答)
2025年6月9日 15:00
insert命令注意哪些语法问题(sql语句中INSERT的使用问题)
2026年8月12日 10:30
fundamental音标(英语leap forward怎么翻译)
2025年11月21日 04:00
scum建房子(SCUM0.8版本悬空房建造攻略悬空房怎么建)
2026年7月11日 03:30
virtue中文(谁知道V打头的英文单词呀 要加中文意思越多越好 谢谢谢谢)
2025年12月17日 23:00
application是什么类型(Excel VBA中APPLICATION是什么意思)
2026年2月18日 21:30
疫情期间应急方案企业模板(公司疫情防控措施方案范文(精选5篇))
2026年1月3日 21:00
es6 阮一峰(来自一位react新手的react入门须知)
2025年8月26日 09:30
common翻译(common ,ordinary,general,usual,normal,natural区别)
2026年2月18日 14:30
discuz自适应模板下载(请问discuz论坛下载的模板安装问题)
2025年9月17日 01:45













