网页中这样的可关闭提示框如何实现?css

html-css027

网页中这样的可关闭提示框如何实现?css,第1张

一个很常见的网站提示栏,一般常用于首页,会给出一行提示文字,用方框框起来,再附上一个关闭按钮,配上JS脚本,这样就实现了一个可以关闭的提示框,实际上代码是超简单的,但是功能却是很实用。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html

xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>可关闭的提示框</title>

<style>

#tips

{

position:relative

margin:0 auto

border:1px solid

#FA9150

padding:5px 10px 5px

10px

width:96%

background-color:#FEF1E9

line-height:160%

font-size:12px

}

#close

{

position:absolute

top:7px

right:8px

}

</style>

<script>

function

Close() {

document.getElementById("tips").style.display =

"none"

}

window.onload = function()

{

document.getElementById("tips").onclick =

Close

}

</script>

</head>

<body>

<p

id="tips">

是因为安装了SublimeCodeIntel插件

解决办法:

首选项 -->

Package Settings -->

SublimeCodeIntel -->

点击:Setting - Defalut

找到:“codeintel_enabled_languages”选项, 把里面的 "HTML" 删除即可 重启编辑器