HTML选择器
伪类选择器
- 基本使用
序号选择器 :nth-child(N)
首元素选择器 :first-child
尾元素选择器 :last-child
not选择器 :not(s) ------> 除了这个选择其他的
不熟悉的JQ,JS方法
- attr(设置被选中元素的属性和值)
$('img').attr("width",'180')
2.onblur(当对象失去焦点后触发的事件)
<input type="text" value='啦啦啦' onblur="myFunction()">
/*然后在js文件中写myFunction()函数*/
document.getElementById("username").onblur=function(){
/*当id为username的元素失去焦点时触发的函数事件*/
}
3.test(用于检测一个字符串是否匹配某个模式.)
var regExpUesrname=/^[a-zA-Z]\w{5,13}$/
var regExpOK=regExpUesrname.test(username.value)
规则.test(str);
返回值:如果字符串中含有与所写正则匹配的文本,则返回true,否则返回false
清除浮动
在元素的after伪元素中加入
.xxx::after{
content:"";
display:block;
height:0;
visibility:hidden;
clear:both;
}