急求一组CSS源代码范例…拜托拜托啦~

html-css015

急求一组CSS源代码范例…拜托拜托啦~,第1张

不知道可不可以用js,我这里有一个以前收藏起来的贴上来,看看可不可以帮助你,下面是代码(图片可以自己换换):

<style>

body{

padding: 0px

margin: 0px

font: 70% verdana, geneva, arial, helvetica, sans-serif

color: #000

text-align: center

}

#outer{

padding: 0px

margin: 0px

width: 800px

text-align: center

}

#focus{

border: #ccc 2px solid

margin: 0px

padding: 0px

padding-top: 15px

background: url(/images/tile.gif) #eee repeat-y left top

width:694px

position: relative

height: 180px

}

#description{

width:550px

height:150px

overflow:hidden

margin-right:15px

float:left

}

.dis{

float:left

width:40px

text-align: center

padding-top:50px

cursor:pointer

}

#description ul, #description li {

float:left

display: inline

margin: 0

padding: 0

height:150px

}

.view_pic a:active,

.view_pic a:visited,

.view_pic a:link {

display: inline

margin: 0

padding: 0

padding-left: 5

padding-right: 5

text-decoration: none

}

.view_pic a:hover {

color: #ffffff

display: inline

text-decoration: none

}

img {border:0px}

</STYLE>

</head>

<body>

<div id=LayerMenu style="display:none z-index: 1000filter: alpha(opacity=0)position: absoluteleft:384pxtop:69pxwidth:126pxheight:20pxborder:1px solid greenbackground:#e11padding:2pxfont-size:12px">抱歉,已经到头了!

</div>

<div id=outer>

<div id=focus>

<div class="dis">

<img id="img_l" src="back.png" alt="向左滚动" onClick="doSlide(-1)" />

</div>

<div id=description>

<div id="view_pic0" style="height:100pxwidth:1650px">

<ul id="view_pic" class=view_pic>

<li><a href="#"><img src="png-0001.png"/></a></li>

<li><a href="#"><img src="png-0002.png"/></a></li>

<li><a href="#"><img src="png-0003.png"/></a></li>

<li><a href="#"><img src="png-0004.png"/></a></li>

<li><a href="#"><img src="png-0005.png"/></a></li>

<li><a href="#"><img src="png-0006.png"/></a></li>

<li><a href="#"><img src="png-0007.png"/></a></li>

<li><a href="#"><img src="png-0008.png"/></a></li>

<li><a href="#"><img src="png-0009.png"/></a></li>

<li><a href="#"><img src="png-0010.png"/></a></li>

<li><a href="#"><img src="png-0011.png"/></a></li>

<li><a href="#"><img src="png-0012.png"/></a></li>

<li><a href="#"><img src="png-0012.png"/></a></li>

</ul>

</div>

</div>

<div class="dis">

<img id="img_r" src="next.png" alt="向右滚动" onClick="doSlide(1)" />

</div>

</div>

</div>

<script>

var ok_obj=document.getElementById("view_pic").getElementsByTagName("LI")

var ok=Math.ceil(ok_obj.length/3)-1

var ele=document.getElementById("description")

var w=ele.clientWidth

var n=20,t=50

var timers=new Array(n)

var k=0doSlide(0)

function doSlide(s){

if (k>=ok &&s>0|| k<=0 &&s<0)MenuClick()

else{

k+=s

var x=ele.scrollLeft

var d=k*w-x

for(var i=0i<ni++)(

function(){

if(timers[i]) clearTimeout(timers[i])

var j=i

// alert(x)

timers[i]=setTimeout(function(){ele.scrollLeft=x+Math.round(d*Math.sin(Math.PI*(j+1)/(2*n)))},(i+1)*t)

}

)()

}}

</script>

<SCRIPT language=javascript>

var intDelay=30//设置菜单显示速度,越大越慢

var intInterval=5

function MenuClick(){

LayerMenu.filters.alpha.opacity=0

LayerMenu.style.display=""

GradientShow()

}

function GradientShow()

{

LayerMenu.filters.alpha.opacity+=intInterval

if (LayerMenu.filters.alpha.opacity<100) setTimeout("GradientShow()",intDelay)

else setTimeout("GradientClose()",1500)

}

function GradientClose()

{

LayerMenu.filters.alpha.opacity-=intInterval

if (LayerMenu.filters.alpha.opacity>0) {

setTimeout("GradientClose()",intDelay)

}

else {

LayerMenu.style.display="none"

}

}

GradientClose()

</SCRIPT>

网页设计常用HTML代码大全

HTML是用来描述网页的一种语言。下面我为大家分享HTML代码,希望对大家学习html代码有帮助!

忽视右键

<body oncontextmenu="return false">

<body style="overflow-y:hidden">

1.如何几秒后转到别的页面?

<META HTTP-EQUIV="Refresh" CONTENT="时间URL=地址">

2.点击关闭窗口

<a href="javascript:top.window.close()">点击关闭窗口</a>!

3.请问如何去掉主页右面的滚动条?

<body scroll="no">

<body style="overflow-y:hidden">

4.请问如何做到让一个网页自动关闭.

<html>

<head>

<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">

<param name="Command" value="Close">

</object>

</head>

<body onload="window.setTimeout(‘‘‘‘closes.Click()‘‘‘‘,10000)">

这个窗口会在10秒过后自动关闭,而且不会出现提示. </body>

如何在不刷新页面的情况下刷新css?

<style>

button{ color:#000000}

</style>

<button onclick=document.styleSheets[0].rules[0].style.color=‘‘‘‘red‘‘‘‘>点击按钮直接修改style标签里button选择符使按钮改为红色</button>

请问如何让网页自动刷新?

在head部记入<META HTTP-EQUIV="Refresh" content="20">其中20为20秒后自动刷新,你可以更改为任意值。

5.如何让页面自动刷新?

方法一,用refresh

HTML 代码片段如下:

<head>

<meta http-equiv="refresh" content="5">

</head>

5表示刷新时间

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

方法二,使用setTimeout控制

<img src=/logo.gif>

<script>

function rl(){

document.location.reload()

}

setTimeout(rl,2000)

</script>

6.如何让超链接没有下划线

在源代码中的<HEAD>…</HEAD>之间输入如下代码:

<style type="text/css"><!--

a { text-decoration: none}

--></style>

7.请问如何去掉IE的上下滚动条?

<body style=‘‘‘‘overflow:scrolloverflow-y:hidden‘‘‘‘>

</body>

8.怎样才能把RealPlayer文件在网页做一个试听连接?

<embed height=25 src=51js.rm type=audio/x-pn-realaudio-plugin width=50 autostart="false" controls="PlayButton">

9.如何用html实现浏览器上后退按钮的功能?

<a href="java script:history.go(-1)">点击后退</a>

或者

<script>history.back() </script>

10.请问怎么在网页中改变鼠标的箭头形状?

HTML 代码片段如下:

<body>

<a href="#" style="cursor: auto">auto</a><br>

<a href="#" style="cursor: crosshair ">crosshair </a><br>

<a href="#" style="cursor: default ">default </a><br>

<a href="#" style="cursor: hand ">hand </a><br>

<a href="#" style="cursor: move ">move </a><br>

<a href="#" style="cursor: e-resize ">e-resize </a><br>

<a href="#" style="cursor: ne-resize ">ne-resize </a><br>

<a href="#" style="cursor: nw-resize">nw-resize</a><br>

<a href="#" style="cursor: n-resize">n-resize</a><br>

<a href="#" style="cursor: se-resize">se-resize</a><br>

<a href="#" style="cursor: sw-resize">sw-resize</a><br>

<a href="#" style="cursor: s-resize">s-resize</a><br>

<a href="#" style="cursor: w-resize">w-resize</a><br>

<a href="#" style="cursor: text">text</a><br>

<a href="#" style="cursor: wait">wait</a><br>

<a href="#" style="cursor: help">help</a><br>

</body>

11.怎样不使用页面的缓存?即每一次打开页面时不是调用缓存中的东西

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

12.页面打开时自动弹出一个窗口的代码怎么写?

HTML 代码片段如下:

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312">

<script language="<B style="color:blackbackground-color:#A0FFFF">javascript</B>">

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

window.open(theURL,winName,features)

}

//-->

</script>

</head>

<body bgcolor="#FFFFFF" text="#000000" onLoad="MM_openBrWindow(‘‘‘‘http://www.35ui.cn/‘‘‘‘,‘‘‘‘,‘‘‘‘width=400,height=400‘‘‘‘)">

</body>

</html>

13.如何让我的页面出现一个会讲话的小人?Merlin

HTML 代码片段如下:

<HTML>

<HEAD>

<TITLE>默林</TITLE>

<META http-equiv=Content-Type content="text/htmlcharset=gb2312">

</HEAD>

<BODY>

<p><OBJECT id=sims classid=CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F>

</OBJECT>

<SCRIPT>

var MerlinID

var MerlinACS

sims.Connected = true

MerlinLoaded = LoadLocalAgent(MerlinID, MerlinACS)

Merlin = sims.Characters.Character(MerlinID)

Merlin.Show()

Merlin.Play("Surprised")

Merlin.Speak("大家好")

Merlin.Play("GestureLeft")

Merlin.Think("我是默林!")

Merlin.Play("Pleased")

Merlin.Think("可爱吗?")

Merlin.Play("GestureDown")

Merlin.Speak("哈哈!")

Merlin.Hide()

function LoadLocalAgent(CharID, CharACS){

LoadReq = sims.Characters.Load(CharID, CharACS)

return(true)

}

</SCRIPT>

</p>

<p></p>

<p>看此效果必须装有office2000!!!</p>

</BODY>

</HTML>

14.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动

HTML 代码片段如下:

<html><head>

<STYLE>

body  {background-image:url(logo.gif)

background-repeat:no-repeatbackground-position:center }

</STYLE>

</head>

<body bgproperties="fixed" >

</body>

</html>

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

background-repeat:no-repeat是让背景图不占满整个页面

body bgproperties="fixed" 是拉动scroll时背景图不动

15.文本输入框什么属性能实现不可输入?

HTML 代码片段如下:

<input type="text" name="textfield" disabled>

或者

<input type="text" name="textfield" readonly>

16.如何禁止自己的页面在别人的框架里打开?

把以下代码加至你的<head>区

<script>

if (window.top!=self){

window.top.location=self.location

}

</script>

17.如何实现首页全屏幕显示?

HTML 代码片段如下:

<html>

<body><script language="<B style="color:blackbackground-color:#A0FFFF">javascript</B>">

var coolw=642

var coolh=400

var coolhuang=window.open("http://www.35ui.cn","coolhuang","width="+coolw+",height="+coolh+",

fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0")

window.close()

</script></body></html>

18.如何监听一个窗口被关闭了?

HTML 代码片段如下:

<body onunload="alert(‘‘‘‘你关闭了这个窗口‘‘‘‘)">

19.如何禁止Ctrl+N?

HTML 代码片段如下:

<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey))>

如何把页面加入用户的收藏夹?

HTML 代码片段如下:

<a href="<B style="color:blackbackground-color:#A0FFFF">javascript</B>:window.external.AddFavorite(‘‘‘‘http://www.35ui.cn‘‘‘‘,‘‘‘‘无忧脚本‘‘‘‘)">收藏无忧脚本</a>

如何在我的'页面中加入背景音乐?

IE: <bgsound src="*.mid" loop=infinite>

NS:<embed src="*.mid" autostart=true hidden=true loop=true>

*.mid你的背景音乐的midi格式文件

关于页面转换效果

<meta http-equiv="page-enter" content="revealTrans(Duration=4,Transition=23)">

<meta http-equiv="page-exit" content="revealTrans(Duration=4,Transition=23)">

说明:Transition=23是随机效果,另可以选0-22任一数字固定某个效果

如何设定打开页面的大小

HTML 代码片段如下:

<body onload="top.resizeTo(300,200)"><!--(width,height)-->

怎样双击滚屏,单击停止?

HTML 代码片段如下:

<html>

<head>

<title>新网页1</title>

</head>

<body>

<script language"<B style="color:blackbackground-color:#A0FFFF">javascript</B>">

var currentpos,timer

function initialize()

{

timer=setInterval("scrollwindow()",10)

}

function sc(){

clearInterval(timer)

}

function scrollwindow()

{

currentpos=document.body.scrollTop

window.scroll(0,++currentpos)

if (currentpos != document.body.scrollTop)

sc()

}

document.onmousedown=sc

document.ondblclick=initialize

</script>

<p>a</p><p>a</p><p>a</p><p>aa</p><p>aa</p><p>aa</p>

<p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p>

<p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p>

<p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>a</p>

</body>

</html>

如何让body中的文字不被选中?

HTML 代码片段如下:

<body onselectstart="return false" >aaa</body>

如何让弹出的窗口不能关闭?

在新开的窗口中加入如下代码

<body onunload=open(location.href)>

</body>

如何让浏览器在保存页面时保存失败?

HTML 代码片段如下:

<NOSCRIPT>

<<B style="color:blackbackground-color:#ffff66">IFRAME</B>SRC="*.html">

</<B style="color:blackbackground-color:#ffff66">IFRAME</B>>

</NOSCRIPT>

表单中如何用图片按钮实现 reset?

<html>

<head>

<script>

function aaa(){

document.forms[0].reset()

}

</script>

</head>

<body>

<form>

<textarea rows="2" name="S1" cols="20"></textarea>

<input type="submit" values="提交" name="B1">

<image src="logo.gif" onclick=aaa()>

</form>

</body></html>

进入网页时弹出的信息对话框

<body onLoad="window.alert(‘‘‘‘欢迎光临本站‘‘‘‘)">

关闭窗口后弹出对话框

<body onUnload="window.alert(‘‘‘‘谢谢你的光临!欢迎下次再来!‘‘‘‘)">

告别提示

<body onUnload= alert("再见,感谢你的访问!")>

右键菜单的制作

<OBJECT id=menu type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">

<PARAM name="Command" value="Related Topics,menu">

<PARAM name="Item1" value="动易http://www.35ui.cn">

<PARAM name="Item2" value="搜狐http://www.35hu.cn">

<PARAM name="Item3" value="新浪http://www.35no.cn">

<PARAM name="Item4" value="网易http://www.chinsgp.cn">

<PARAM name="Item5" value="互动学院http://www.35ui.cn">

</OBJECT><script>if (document.all) document.body.onmousedown=new Function("if (event.button==2) menu.Click()") </script>

下拉菜单

<object id=HHCtrl type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><PARAM name="Command" value="Related Topics,Menu"><PARAM name="Item1" value="aspeasehttp://www.35ui.cn"><PARAM name="Item2" value="byhuhttp://www.35ui.cn"><PARAM name="Item3" value="lzzhttp://www.35ui.cn"></object><a href=javascript:HHCtrl.Click() title="下拉菜单">下拉菜单</a>