隐藏html里的url,去除HTML里的标签

Dim WoDig

Set WoDig = New Woddig_Class

Class Woddig_Class

'截取定义长度的字符。。。。

Public Function get_StrLen(str,len2)

if str = "" or isNull(str) or len2 = 0 then

get_StrLen = ""

else

if len(str) < len2 then

get_strLen = str

else

get_strLen = left(str,len2) & "。。。 "

end if

end if

End Function

'专门用来去除内容中的文本害码。。。

Public Function DecodeFilter(html, filter)

html=LCase(html)

filter=split(filter,",")

For Each i In filter

Select Case i

Case "SCRIPT"   ' 去除所有客户端脚本javascipt,vbscript,jscript,js,vbs,event,...

html = exeRE("(javascript|jscript|vbscript|vbs):", "#", html)

html = exeRE("?script[^>]*>", "", html)

html = exeRE("on(mouse|exit|error|click|key)", "", html)

Case "TABLE":   ' 去除表格

html = exeRE("?table[^>]*>", "", html)

html = exeRE("?tr[^>]*>", "", html)

html = exeRE("?th[^>]*>", "", html)

html = exeRE("?td[^>]*>", "", html)

html = exeRE("?tbody[^>]*>", "", html)

Case "CLASS"   ' 去除样式类class=""

html = exeRE("(]+) class=[^ |^>]*([^>]*>)", "$1 $2", html)

Case "STYLE"   ' 去除样式

html = exeRE("(]+) [^""]*""([^>]*>)", "$1 $2", html)

html = exeRE("(]+) style='[^']*'([^>]*>)", "$1 $2", html)

Case "IMG"   ' 去除样式

html = exeRE("?img[^>]*>", "", html)

Case "XML"   ' 去除XML<?xml>

html = exeRE("]*>", "", html)

Case "NAMESPACE" ' 去除命名空间

html = exeRE("]*>", "", html)

Case "FONT"   ' 去除字体

html = exeRE("?font[^>]*>", "", html)

Case "MARQUEE"   ' 去除字幕

html = exeRE("?marquee[^>]*>", "", html)

Case "OBJECT"   ' 去除对象

html = exeRE("?object[^>]*>", "", html)

html = exeRE("?param[^>]*>", "", html)

'html = exeRE("?embed[^>]*>", "", html)

Case "EMBED"

html =   exeRE("?embed[^>]*>", "", html)

Case "DIV"   ' 去除对象

html = exeRE("?div([^>])*>", "$1", html)

Case "ONLOAD"   ' 去除样式

html = exeRE("(]+)  "$1 $2", html)

html = exeRE("(]+)  "$1 $2", html)

Case "ONCLICK"   ' 去除样式

html = exeRE("(]+)  "$1 $2", html)

html = exeRE("(]+)  "$1 $2", html)

Case "ONDBCLICK"   ' 去除样式

html = exeRE("(]+) ondbclick=""[^""]*""([^>]*>)", "$1 $2", html)

html = exeRE("(]+) ondbclick='[^']*'([^>]*>)", "$1 $2", html)

End Select

Next

'html = Replace(html,"

'html = Replace(html,"

'html = Replace(html,"

DecodeFilter = html

End Function

'用于将介绍信息中的链接转成在新窗口打开 2006-12-17 12:30 Add By Lingye

Function ChangeURLTarget(inputhtml,targetname)

inputhtml=exeRE("(]+)(href='[^']*')([^>]*>.+?)","

inputhtml=exeRE("(]+)(href=""[^""]*"")([^>]*>.+?

)","

inputhtml=exeRE("(]+)(href=[\S]+?)([\s][^>]*>.+?

)","

ChangeURLTarget=inputhtml

End Function

'正则替换。。。

Public Function exeRE(re, rp, content)

Set oReg = New RegExp

oReg.IgnoreCase =True

oReg.Global=True

oReg.Pattern=re

r = oReg.Replace(content,rp)

Set oReg = Nothing

exeRE = r

End Function

'取得回复状态。。。

Public Function Get_RevertState()

Response.Write("

"&Conn.execute("Select Count(User_ID) From WoWo_User")(0)&" "&Web_UserCName&"提供了"&Conn.Execute("Select Count(Re_ID) From WoWo_SrcRevert")(0)&" 个网站评论!
")

End Function

'取得RSS

Public Sub Get_Rss

Response.Write("

Response.Write("

"&vbcr)

           Response.Write("

用RSS阅读全站 
"&vbcr)

Response.Write("

"&vbcr)

Response.Write("

"&vbcr)

End Sub

'取得GMail状态。。。

Public Function Get_GmailState()

Response.Write(""&Conn.execute("Select Count(User_ID) From WoWo_User")(0)&" "&Web_UserCName&"提供了"&Conn.Execute("Select Count(Gmail_ID) From WoWo_SrcGmail")(0)&" 个八卦!")

End Function

'取得全网址。。。

Public Function GetUrl2()

Dim strTemp

If LCase(Request.ServerVariables("HTTPS")) = "off" Then

strTemp = "http://"

Else

strTemp = "https://"

End If

strTemp = strTemp & Request.ServerVariables("SERVER_NAME")

If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")

strTemp = strTemp & Request.ServerVariables("URL")

if Request.QueryString<> "" then

strTemp = strTemp & "?" & Request.QueryString

end if

GetUrl2 = strTemp

End Function

'显示标签。。。

Public Function Get_TagsList(num,rowCount,num2,type1,type2)

Set Rs_tags = Server.CreateObject("adodb.recordset")

if type2 = "SYS" then

Sql = "SELECT wowo_srctags.srctag_tagid, Count(WoWo_SrcTags.SrcTag_id) AS Tag_Count,(select tag_name from wowo_tags where tag_id=wowo_srctags.srctag_tagid) as tag_name FROM WoWo_SrcTags where wowo_srctags.srctag_ttype=true GROUP BY wowo_srctags.srctag_tagid Order By Count(WoWo_SrcTags.SrcTag_id) Desc"

else

Sql = "SELECT wowo_srctags.srctag_name, Count(WoWo_SrcTags.SrcTag_id) AS Tag_Count FROM WoWo_SrcTags where wowo_srctags.srctag_ttype=false and wowo_srctags.srctag_name<>'' GROUP BY wowo_srctags.srctag_name Order By Count(WoWo_SrcTags.SrcTag_id) Desc"

end if

Rs_tags.open Sql,conn,1,2

tagsList_I = 0

While not Rs_tags.Eof and tagsList_I < num

tagsList_I = tagsList_I + 1

if type2 = "SYS" then

Response.Write("  * " & Server.HTMLEncode(Rs_tags("tag_name")) &"("&Rs_tags("Tag_Count")&")")

if cint(rowCount) <> 0 then '固定标签才有换行显示

if tagsList_I mod rowCount = 0 then Response.Write("
")

end if

else

Response.Write(" * " & Server.HTMLEncode(Rs_tags("srctag_Name"))&"("&Rs_tags("Tag_Count")&")")

end if

Rs_tags.MoveNext

Wend

Rs_tags.close

Set Rs_tags = nothing

End Function

'添加自定义标签

Public Function Add_NewTags(Src_ID,Tags_str)

Sql_SrcTags = "Insert into WoWo_SrcTags(SrcTag_SrcID,SrcTag_Name,SrcTag_TType,SrcTag_IP)Values("&Src_ID&",'"&Tags_str&"',false,'"&Request.ServerVariables("REMOTE_ADDR")&"')"

conn.execute(Sql_SrcTags)

End Function

'取得网址带http://。。。

Public Function Get_UrlStr(url)

src_Url = lcase(url)

if   left(src_Url,7) = "http://" then

src_Url = right(src_Url,len(src_Url) - 7) '去掉 http://

end if

Src_Url_Arr = split(src_Url,"/")

src_Url = Src_Url_Arr(0) '去掉 第一个 / 以后的

src_Url = "http://" & src_Url '再重新装上 http://

Get_UrlStr = src_Url

End Function

'取得资源状态。。。

Public Function Get_SrcState()

Get_SrcState = "有"&conn.ExeCute("SELECT count(User_ID) FROM WoWo_User")(0)&"个"&Web_UserCName&",提供了"& Conn.Execute("SELECT count(Src_ID) FROM WoWo_Source WHERE Src_IsOver=False")(0) &"个资源信息,分享了"&Conn.Execute("SELECT count(Re_ID) FROM WoWo_SrcRevert")(0)&"条资源评论!"

End Function

'取得文章条数和用户个数的标题。。。

Public Function Get_SrcRecordCount

Temp_Str = "有"& Conn.Execute("SELECT count(User_ID) FROM WoWo_User")(0) &"个"&Web_UserCName&","

Temp_Str = Temp_Str & "提供了"& Conn.Execute("SELECT count(Src_ID) FROM WoWo_Source WHERE Src_IsOver=False")(0) &"个资源,"

Temp_Str = Temp_Str & "分享了"&Conn.Execute("SELECT Count(Re_ID) FROM WoWo_SrcRevert")(0)&"条资源评论!"

Get_SrcRecordCount = Temp_Str

End Function

'取得文章标签。。。

Public Function Get_SrcTags(Src_ID)

Set Rs_Tags2 = Server.CreateObject("Adodb.recordset")

Sql_Tag2 = "Select SrcTag_ID,SrcTag_Name from WoWo_SrcTags Where SrcTag_SrcID="&Src_ID&" and srctag_ttype=false"

Rs_Tags2.open Sql_Tag2,conn

while not Rs_Tags2.eof

Src_Tags_2 = Src_Tags_2 & "" & Rs_Tags2("SrcTag_Name") &" "

Rs_Tags2.MoveNext

wend

Rs_Tags2.Close

Sql_Tag2 = "Select WoWo_SrcTags.SrcTag_ID,WoWo_Tags.tag_ID,WoWo_Tags.tag_Name from WoWo_SrcTags inner join WoWo_Tags on WoWo_SrcTags.SrcTag_TagID=WoWo_Tags.tag_ID Where WoWo_SrcTags.SrcTag_SrcID="&Src_ID&" and srctag_ttype=true"

Rs_Tags2.open Sql_Tag2,conn

while not Rs_Tags2.eof

Src_Tags_2 = Src_Tags_2 & "" & Rs_Tags2("tag_Name") &" "

Rs_Tags2.MoveNext

wend

Rs_Tags2.Close

Set Rs_Tags2 = nothing

if Src_Tags_2 <> "" then

Get_SrcTags = Src_Tags_2

else

Get_SrcTags = "无标签"

end if

End Function

'是否已顶。。

Public Function Is_Hit(Src_ID)

Temp_HitStr = ""

if Session("_WUserID") = "" then

Temp_HitStr = "顶一下"

else

Set Temp1   = conn.execute("Select Src_ID From WoWo_Source Where Src_ID="&Src_ID&" and Src_UserID="&Session("_WUserID"))

If not Temp1.eof then

Is_Hit=true

Temp1.close

set Temp1=nothing

end if

Set Temp2   = conn.execute("Select Hit_ID From WoWo_SrcHit Where Hit_SrcID="&Src_ID&" and Hit_UserID="&Session("_WUserID"))

If not Temp2.eof then

Is_Hit=true

Temp2.close

set Temp2=nothing

end if

If Is_Hit=true   then

Temp_HitStr = "已顶"

else

Temp_HitStr = "顶一下"

end if

end if

Is_Hit = Temp_HitStr

End Function

'我顶。。。。。

Public Function Set_Hit(src_ID)

if Session("_WUserID") = "" then '判断是否登入

Response.Write("顶一下")

else

Is_Hit_Temp = Conn.Execute("Select Count(Hit_ID) From WoWo_SrcHit Where Hit_SrcID="&Src_ID&" and Hit_UserID="&Session("_WUserID"))(0)

if Is_Hit_Temp <= 0 then '判断是否顶完(避免开多个窗口的问题)

Sql_Hit = "Insert into WoWo_SrcHit(Hit_SrcID,Hit_UserID,Hit_Time,Hit_IP)"

Sql_Hit = Sql_Hit & "Values(" & src_id & ",'" & Session("_WUserID") & "','" & Now() & "','" & Request.ServerVariables("REMOTE_ADDR") & "')"

Conn.Execute(Sql_Hit)

Conn.Execute("Update WoWo_Source Set Src_HitNum=Src_HitNum+1,Src_HitUpdate='"&Now()&"' Where Src_ID="&src_id)

response.redirect request.querystring("HitBackUrl")

response.end

else

Response.Write("已顶")

end if

end if

End Function

'直接取得大类列表。。。

Public Function Get_SrcType(sel_id)

Set Rs_SrcType = Conn.Execute("Select * from WoWo_SrcType Where Type_IsUse=true Order By Type_OrderBy")

While Not Rs_SrcType.Eof

selected = ""

if cint(Rs_SrcType("Type_ID")) = cint(sel_id) then

selected = " selected"

end if

Response.Write(""&Rs_SrcType("Type_Name")&"")

Rs_SrcType.MoveNext

Wend

Rs_SrcType.Close

Set Rs_SrcType = Nothing

End Function

'直接取得小类列表。。。。

Public Function Get_SrcChild(sel_id)

Set Rs_SrcChild = Conn.Execute("Select * from WoWo_SrcChild Where Child_IsUse=true Order By Child_OrderBy")

While Not Rs_SrcChild.Eof

selected = ""

if cint(Rs_SrcChild("Child_ID")) = cint(sel_id) then

selected = " selected"

end if

Response.Write(""&Rs_SrcChild("Child_Name")&"")

Rs_SrcChild.MoveNext

Wend

Rs_SrcChild.Close

Set Rs_SrcChild = Nothing

End Function

'取得小类列表(大类的ID)。。。。

Public Function Get_SrcChild2(Type_ID,sel_id)

Set Rs_SrcChild = Conn.Execute("Select * from WoWo_SrcChild Where Child_IsUse=true and Child_TypeID="&Type_ID&" Order By Child_OrderBy")

While Not Rs_SrcChild.Eof

selected = ""

if cint(Rs_SrcChild("Child_ID")) = cint(sel_id) then

selected = " selected"

end if

Response.Write(""&Rs_SrcChild("Child_Name")&"")

Rs_SrcChild.MoveNext

Wend

Rs_SrcChild.Close

Set Rs_SrcChild = Nothing

End Function

Public Function Get_Line

Response.Write("

Response.Write("

")

Response.Write("

")

End Function

Public Sub Get_SrcSearch

Response.Write("

Response.Write("

"&Vbcr)

Response.Write("

找资源
"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write(""&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write(""&Vbcr)

Response.Write(""&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&WoDig.Get_SrcState()&"
"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

Response.Write("

"&Vbcr)

End Sub

'==================================================系统函数==================================

Public Function SendMail(MailtoAddress,MailtoName,Subject,MailBody,Priority)

MailServerUserName = Web_EmailUserName

MailServerPassword = Web_EmailUserPass

MailDomain = Web_EmailUserName

MailServer = Web_EmailServer

FromName = Web_Name

MailFrom = Web_EmailUserName

on error resume next

Dim JMail

Set JMail=Server.CreateObject("JMail.Message")

if err then

SendMail= "

没有安装JMail组件"

err.clear

exit function

end if

JMail.Charset = "gb2312"

JMail.silent = true

JMail.ContentType = "text/html"

JMail.MailServerUserName = MailServerUserName

JMail.MailServerPassWord = MailServerPassword

JMail.MailDomain = MailDomain

JMail.AddRecipient MailtoAddress,MailtoName

JMail.Subject = Subject

'JMail.HMTLBody = MailBody        '邮件正文(HTML格式)

JMail.Body   = MailBody

JMail.FromName = FromName

JMail.From    = MailFrom

JMail.Priority = Priority

JMail.Send(MailServer)

SendMail    = JMail.ErrorMessage

JMail.Close

Set JMail   = nothing

End Function

'提示。。

Public Function MsgBox2(HintText,HintType,GoWhere)

Dim Hint,HintTypeText

Select Case HintType

Case "0"

Hint=16

HintTypeText="出错啦!"

Case "1"

Hint=48

HintTypeText="警告!"

Case "2"

Hint=64

HintTypeText="提示!"

End Select

Response.Write "

Response.Write "MsgBox """ & Replace(HintText,"'","") &_

"""," & Hint & ",""" & HintTypeText & """ "

Response.Write ""

if GoWhere<>"" then

if GoWhere = "0" then

Response.Write ""

else

Response.Write ""

end if

end if

Response.End()

End Function

'创建一个KEY。。。

Public Function Pub_Createpass()

Dim Ran,i,LengthNum

LengthNum=16

Createpass=""

For i=1 To LengthNum

Randomize

Ran = CInt(Rnd * 2)

Randomize

If Ran = 0 Then

Ran = CInt(Rnd * 25) + 97

Pub_Createpass = Pub_Createpass& UCase(Chr(Ran))

ElseIf Ran = 1 Then

Ran = CInt(Rnd * 9)

Pub_Createpass = Pub_Createpass & Ran

ElseIf Ran = 2 Then

Ran = CInt(Rnd * 25) + 97

Pub_Createpass = Pub_Createpass& Chr(Ran)

End If

Next

End Function

'设置图片。。

Public Function Pub_SetImgWH(IMGPath,MaxW,MaxH)

'

Set PP = New ImgWHInfo

W = PP.imgW(lcase(Server.Mappath(IMGPath)))

H = PP.imgH(lcase(Server.Mappath(IMGPath)))

Set pp = Nothing

if W>MaxW then

H=H*MaxW/W

W=MaxW

end if

if H >MaxH then

W=W*MaxH/H

H=MaxH

end if

Pub_SetImgWH = "src='"&IMGPath&"' width='"&int(W)&"' height='"&int(H)&"'   "

End Function

'删除文件。。。。

Public Sub DelFiles(delfilesname,filespath)

Dim FileDelete,files,strFileFullPath,filesNum

If Right(filespath,1)<>"\" Then filespath = filespath & "\"

If delfilesname<>"" And Not IsNull(delfilesname) Then

Set FileDelete = CreateObject("Scripting.FileSystemObject")

files = Split(delfilesname & "|","|")

For filesNum=0 to Ubound(files)-1

strFileFullPath = filespath + files(filesNum)

If FileDelete.FileExists(strFileFullPath) Then FileDelete.DeleteFile(strFileFullPath)

Next

End If

End Sub

'检测输入。。。

Public Function Checkin(s)

s = trim(s)

s = replace(s," ","&nbsp;")

s = replace(s,"'","&#39;")

s = replace(s,"""","&quot;")

s = replace(s,"<","&lt;")

s = replace(s,">","&gt;")

Checkin=s

End Function

Public Function CreateMultiFolder(ByVal CFolder)

Dim objFSO,PhCreateFolder,CreateFolderArray,CreateFolder

Dim i,ii,CreateFolderSub,PhCreateFolderSub,BlInfo

BlInfo = False

CreateFolder = CFolder

On Error Resume Next

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

If Err Then

Err.Clear()

Exit Function

End If

CreateFolder = Replace(CreateFolder,"\","/")

If Right(CreateFolder,1)="/" Then

CreateFolder = Left(CreateFolder,Len(CreateFolder)-1)

End If

CreateFolderArray = Split(CreateFolder,"/")

For i = 0 to UBound(CreateFolderArray)

CreateFolderSub = ""

For ii = 0 to i

CreateFolderSub = CreateFolderSub & CreateFolderArray(ii) & "/"

Next

PhCreateFolderSub = Server.MapPath(CreateFolderSub)

If Not objFSO.FolderExists(PhCreateFolderSub) Then

objFSO.CreateFolder(PhCreateFolderSub)

End If

Next

If Err Then

Err.Clear()

Else

BlInfo = True

End If

Set objFSO=nothing

CreateMultiFolder = BlInfo

End Function

End Class

%>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
详尽的前端笔记,包含html和css部分,由xmind8做的笔记。css部分:编写的位置 1.内联样式 将样式编写到标签的style属性中 <p style="color:red;"></p> 这种样式只会对当前标签起作用,不能对样式进行复用,不方便后期维护,不推荐使用 2.内部样式表 将样式表编写到head中的style标签中 <style type="text/css"></style> 使用内部样式表,进一步将表现和结构分离,可以同时为多个元素设置样式,方便后期的维护 3.外部样式表 将样式表编写到外部的CSS文件中,然后通过link标签将外部文件引入 <link rel="stylesheet" type="text/css" href="文件的路径"/> 将样式编写到外部样式表中,可以在不同的页面中使用同一个样式表,完全将表现和结构分离,方便后期的维护,推荐使用的方式 编写的位置 1.内联样式 将样式编写到标签的style属性中 <p style="color:red;"></p> 这种样式只会对当前标签起作用,不能对样式进行复用,不方便后期维护,不推荐使用 2.内部样式表 将样式表编写到head中的style标签中 <style type="text/css"></style> 使用内部样式表,进一步将表现和结构分离,可以同时为多个元素设置样式,方便后期的维护 3.外部样式表 将样式表编写到外部的CSS文件中,然后通过link标签将外部文件引入 <link rel="stylesheet" type="text/css" href="文件的路径"/> 将样式编写到外部样式表中,可以在不同的页面中使用同一个样式表,完全将表现和结构分离,方便后期的维护,推荐使用的方式 基本语法 选择器 通过选择器可以选中页面中的一组元素,然后为其设置样式 元素选择器 根据标签名,选中页面中的指定元素 语法:标签名{ } 例子: div{} p{} h1{} id选择器 根据元素的id属性值选中一个唯一的元素 语法:#id {} 例子: #box1{} #hello{} 类选择器 根据元素的class属性值,选中一组元素 语法:.class{} 例子: .hello{} .box{} 通配选择器 选中页面中的所有元素 语法:*{} 通配选择器的性能比较差,尽量避免使用 并集选择器 可以同时选中符合多个选择器的元素 语法:选择器1,选择器2,选择器N{} 例子: div,p,#box,.hello{} 交集选择器 可以选中满足多个条件的元素 语法:选择器1选择器2选择器N{} 例子:p.hello{} 后代元素选择器 选中指定元素的指定后代元素 语法:祖先元素 后代元素{} 例子: div span {} div p{} 子元素选择器 选中指定元素的指定子元素 语法:父元素 > 子元素 {} 例子: div > span {} div > p{} 声明块 声明块中实际上就是一个一个CSS声明 声明 每一个CSS声明都是一个样式,实际上就是一个名值对的结构 名和值之间使用:链接 :左边是样式的名字 :右边是样式的值 每一个声明以;结尾 例子 color:red; font-size:20px; 元素之间的关系 父元素 直接包含子元素的的元素叫做父元素 子元素 直接被父元素包含的元素叫做子元素 祖先元素 直接或间接包含后代元素的元素叫做祖先元素,父元素也是祖先元素 后代元素 直接或间接被祖先元素包含的元素叫后代元素,子元素也是后代元素 兄弟元素 拥有相同父元素的元素叫做兄弟元素 块元素和内联元素 块元素 块元素会独占页面中的一行,无论他的内容的多少 一般使用块元素对页面进行布局 常见的块元素 div p h1~h6 内联元素 内联元素只占用自身的大小,不会独占一行 内联元素也叫行内元素(inline) 一般内联元素都是用来为文本来设置效果 常见的内联 span a img 包裹规则 一般都是使用块元素去包裹内联元素,而不会使用内联去包裹块元素 a元素可以包含任意元素,除了a本身 p元素不能包含任何块元素 伪类和伪元素 伪类和伪元素用来表示元素所处的一个特殊的状态,或者是一个特殊的位置 :link 表示一个普通的链接(未访问过的链接) :visited 表示访问过的链接 :hover 鼠标移入的链接,也可以为其他元素设置hover :active 正在被点击的链接,也可以为其他元素设置active :focus 表示元素获取焦点的状态,一般用于文本框 ::selection 表示内容被选中的状态 在火狐中使用::-moz-selection来代替 :first-letter 表示第一个字符 :first-line 表示文字的第一行 :before 选中元素的最前边 一般该伪类都会结合content一起使用,通过content可以向指定位置添加内容 :after 选中元素的最后边 一般该伪类都会结合content一起使用,通过content可以向指定位置添加内容 属性选择器 根据元素的属性选择指定元素 [属性名] 选取含有指定属性的元素 [属性名="属性值"] 选取属性值等于指定值的元素 [属性名^="属性值"] 选取属性值以指定内容开头的元素 [属性名$="属性值"] 选取属性值以指定内容结尾的元素 [属性名*="属性值"] 选取属性值中包含指定内容的元素 兄弟元素选择器 选取后一个兄弟元素 前一个 + 后一个 选取后边所有的兄弟元素 前一个 ~ 后边所有 子元素的伪类 :first-child 寻找父元素的第一个子元素,在所有的子元素中排序 :last-child 寻找父元素的最后一个子元素,在所有的子元素中排序 :nth-child 寻找父元素中的指定位置子元素,在所有的子元素中排序 例子 p:nth-child(3) 可以使用even,来找到偶数的子元素 可以使用odd,来找到奇数的子元素 :first-of-type 寻找指定类型中的第一个子元素 :last-of-type 寻找指定类型中的最后一个子元素 :nth-of-type 寻找指定类型中的指定子元素 否定伪类 从一组元素中将符合要求的元素剔除出去 语法: :not(选择器) 例子: .abc:not(div) HTML,超文本标记语言 负责页面中的结构,定义出页面中的各个组成部分 HTML是采用纯文本的形式的编写,采用HTML标签来标识出页面中的不同部分 标签 成对出现 <标签名></标签名> 自结束标签 <标签名 /> 属性 通过属性可以设置标签的效果 属性需要定义在开始标签中或这自结束标签中 属性实际上是一组一组名值对结构 例子: <标签名 属性名="属性值" 属性名="属性值"></标签名> <标签名 属性名="属性值" 属性名="属性值" /> HTML页面的基本结构 常用标签 <html> 网页的根标签 一个页面中有且只有一个根标签 网页中的所有内容都需要写在html标签的内部 <head> 网页的头部 该标签中的内容不会在网页中直接显示 该标签用于帮助浏览器解析页面 子标签 <title> 用来设置网页的标题 默认会在浏览器的标题栏中显示 搜索引擎检索网页时,会主要检索title中的内容,它会影响到页面在搜索引擎中的排名 <meta> 用来设置网页的元数据,比如网页使用的字符集 <meta charset="utf-8" /> 设置网页的关键字 <meta name="keywords" content="关键字,关键字,关键字,关键字"/> 设置网页的描述 <meta name="description" content="网页的描述"/> 请求的重定向 <meta http-equiv="refresh" content="秒数;url=地址" /> <body> 网页的主体 网页中所有的可见部分都需要在body中编写 <h1> ~ <h6> 标题标签html中一共有六级标题 六级标题中,h1最重要,h6最不重要,一般页面中只会使用h1~h3 h1的重要性仅次于title,浏览器也会主要检索h1中的内容,以判断页面的主要内容 一般一个页面中只能写一个h1 <p> 段落标签 <br /> 换行标签 <hr /> 水平线标签 内联框架 可以向一个页面中引入其他的外部页面 <iframe></iframe> 属性 src 外部页面的地址,可以使用相对路径 width和height 可以设置框架的宽度和高度 name 可以为内联框架指定一个名字 可以将该属性值设置为超链接的target属性的值 这样当点击超链接时,页面将会在相应的内联框架中打开 内联框架中的内容不会被搜索引擎所检索,所以开发中尽量不要使用内联框架 超链接 可以使当前页面跳转到其他的页面 <a>链接的文字</a> 属性 href 指向链接跳转的目标地址,可以是一个相对路径 还可以是#id属性值,这样当点击超链接以后,将会跳转到当前页面的指定位置 可以使用mailto:来创建一个发送电子邮件的超链接 target 指定在哪个窗口中打开链接 可选值 _self 默认值,默认在当前窗口打开链接 _blank 在新窗口中打开链接 内联框架的name属性值 在指定的内联框架中打开链接 注释 语法 <!-- 注释内容 --> 注释中的内容不会在页面中显示,但是会在源码中显示,我们可以通过注释来说明网页的代码 也可以通过注释隐藏一些页面中不想显示的内容 实体 在HTML页面中一些特殊符号是不能直接使用,需要使用实体来代替这些特殊符号 实体也可以称为转义字符 实体的语法 &实体名; 常用的实体 空格   < < > > 版权符号 © 图片标签 <img /> 使用图片标签可以向页面中引入一个外部图片 属性 src 指向一个外部图片的路径,可以使用相对路径 alt 指定一个在图片无法加载时对图片的描述 搜索引擎主要通过该属性来识别图片的内容 如果不写该属性则搜索引擎会对图片进行收录 width 设置图片的宽度 height 设置图片的高度 图片的格式 JPEG 颜色丰富的图片,如,照片 GIF 颜色单一,简单透明的图片,动态图 PNG 颜色丰富,复杂透明的图片 图片选择的原则 效果一致,用小的 效果不一致,用效果好的 相对路径 相对于当前资源所在的目录的路径 可以使用../返回一级目录,返回几级使用几个../ xHtml语法规范 1.HTML中不区分大小写,但是尽量使用小写 2.HTML的注释不能嵌套 3.标签必须结构完整 要么成对出现 要么自结束标签 4.标签可以嵌套但是不能交叉嵌套 5.属性必须有值,且值必须加引号,单引号双引号都可以 文本标签 <em> 表示语气上的强调 <strong> 表示内容的重要性 <i> 表示单纯的斜体 <b> 表示单纯的加粗 <small> 表示细则一类的内容 <cite> 表示参考的内容,凡是加书名号的都可以使用cite <q> 短引用,行内引用 <blockquote> 长引用,块级引用 <sup> 上标 <sub> 下标 <del> 删除的内容 <ins> 插入的内容 <pre> 预格式标签,可以保留代码中空格换行这些格式 <code> 表示程序代码 列表 无序列表 使用ul来创建一个无序列表,在列表中使用li来表示一个列表项 无序列表使用符号作为项目符号 有序列表 使用ol来创建一个无序列表,在列表中使用li来表示一个列表项 使用有序的序号作为项目符号 定义列表 列表相关的元素都是块元素,他们之间可以互相嵌套 去除项目符号 list-style:none

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值