您现在的位置是:网站首页 >> 代码素材
代码素材

联 系 人:李总
联系电话:13759574266
在线 QQ:89417157
邮箱:13759574266@qq.com
微信号:ynlongtou
地址:昆明市滇缅大道旁昆建路5号108智库空间A座4楼

代码素材

简单常用样式及代码

设置网页距离顶部和左右为无间隙:body{margin: 0px; padding: 0px;}

设置ul和li无任何样式:ul{list-style: none;}  li{list-style: none;} ol{list-style: none;}

设置图片无边框:img{border:0}

按钮或表单框去样式:input{outline:none;}

去掉搜索等框线:input,textarea,select,button{font-family:inherit; font-size:inherit; font-weight:inherit; outline-style:none; outline-width:0pt; resize:none; padding: 0; margin: 0;}

设置背景图片:{BACKGROUND: url(/images/bg.jpg); }

设置背景颜色:{background-color:#ffffff; }

给样式加边框和颜色及设置圆角.ys{width:100px; border:#999999 1px solid; border-radius:5px 5px 5px 5px;}

给td四周加线条:<td bgcolor="#ddcdb3" style="BORDER-left: #b39d7a 1px solid; BORDER-right: #b39d7a 1px solid; BORDER-top: #b39d7a 1px solid; BORDER-bottom: #b39d7a 1px solid;">

设置某个图片样式有边框:.divcss5 img{border:1px solid #F00 }

设置表边框为虚线样式一:.xtys{border:1px dashed #000; width:350px; height:50px;}

设置边框为虚线样式二:.xxys{border:dotted 1px #c7c7c7;}或某一边{border-right: dotted 1px #c7c7c7;}

设置字体、大小和颜色及居中:.ys{font-family:"微软雅黑"; font-size:18px; color:#ff0000; text-align: center; }

单独给字体加颜色:<font color="#FF0000">我是红色字体</font>

设置div居中:.jz{margin:0 auto;}或<center><div></div></center>

asp注释代码:<!--需要被注释的内容-->

asp获取当前日期并加三天后的时间:<%=Date()+3%>

css样式中的注释代码:/*需要被注释的内容*/

背景图片拉伸效果:<img border='0' src='images/bg.jpg' width='100%' height='100%' style='position: absolute;left:0px;top:0px;z-index: -1'>

浏览器兼容模式代码:

<meta name="renderer" content="webkit|ie-comp|ie-stand">

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<meta http-equiv="x-ua-compatible" content="IE=7" >

兼容IE7:<meta http-equiv="X-UA-Compatible" content="IE=7" />

进入网站自动跳转:<meta http-equiv="refresh" content="0;url= /m ">

给网站加favicon.ico图标:

<head>

<link rel="shortcut icon" href="/favicon.ico"/>

<link rel="bookmark" href="/favicon.ico"/>

</head>

asp调用当前日期时间方法一:

<%

response.write formatdatetime(now,0)&"<br>"

response.write formatdatetime(now,1)&"<br>"

response.write formatdatetime(now,2)&"<br>"

response.write formatdatetime(now,3)&"<br>"

response.write formatdatetime(now,4)&"<br>"

%>

方法二:<%=now()%>

打开网页4秒后弹出窗口

<script type='text/javascript'>

setTimeout(function(){alert('这里是弹出的内容')},4000);//界面加载四秒后执行弹出窗口的方法。

</script>

网页禁止右键:<meta http-equiv="MSThemeCompatible" content="Yes">

禁止左键:<body onselectstart="return false"> 

禁止右键:<body oncontextmenu=self.event.returnvalue=false> 

结合起来禁止左右键:<body oncontextmenu=self.event.returnvalue=false onselectstart="return false">

给表格加边框:

设置样式

<style> 

.table-c table{border-right:1px solid #c6c6c6; border-bottom:1px solid #c6c6c6}

.table-c table td{border-left:1px solid #c6c6c6; border-top:1px solid #c6c6c6; line-height:30px; text-indent:10px;}

</style>

源代码片段

<div class="table-c"> 

<table width="400" border="0" cellspacing="0" cellpadding="0"> 

<tr> 

<td width="180">云南龙头科技</td> 

<td width="110">专业建站</td> 

<td width="110">软件开发</td> 

</tr> 

<tr> 

<td>www.ynlongtou.com</td> 

<td>商城建设</td> 

<td>系统开发</td> 

</tr> 

</table> 

</div>

li里面不换行

white-space:nowrap;     //强制不换行

overflow:hidden;           //自动隐藏文字

text-overflow: ellipsis;    //文字隐藏后添加省略号

-o-text-overflow:ellipsis; //适用于opera浏览器

/*当屏幕小于640px的时候显示的样式*/

@media only screen and (max-width:640px){

.w{ width:320px;}/*这里是css的样式*/

}

white-space:nowrap;不换行样式

.ys{height:25px;line-height:25px;font-size:12px;width:120px;overflow:hidden;}/*内容溢出120px时将自动隐藏;*/

<a>标签中的href="javascript:;"是什么意思?

例子:<a href="javascript:;">云南龙头科技</a>

javascript:是一个伪协议

javascript:是表示在触发<a>默认动作时,执行一段JavaScript代码,而 javascript:; 表示什么都不执行,这样点击<a>时就没有任何反应。

href="javascript:;"就是去掉a标签的默认行为,跟href="javascript:void(0)"是一样的?

void 是JavaScript 的一个运算符,void(0)就是什么都不做的意思。