css怎么让<a>标签失去链接作用?

html-css010

css怎么让<a>标签失去链接作用?,第1张

p>去掉href属性即可,也可以换成其他标签<a 或<span>ddd</a>target="_blank">ddd&lt。

CSS(层叠样式表)是一种用来表现HTML或XML等文件样式的计算机语言。

CSS不仅可以静态地修饰网页,还可以配合各种脚本语言动态地对网页各元素进行格式化。有三种方法可以在站点网页上使用样式表:外部样式表、内部样式表和内联样式。

CSS具有精简代码,降低重构难度、提升网页访问速度、利于SEO优化等优势,能够对网页中元素位置的排版进行像素级精确控制,支持几乎所有的字体字号样式,拥有对网页对象和模型样式编辑的能力。

FrontPage2000 包含有能用来为站点创建外部样式表的模板。可以用空白模板或已包含样式的模板来创建(例如 Arcs)。当保存样式表时, FrontPage 会以 . css 作为文件扩展名。要编辑样式表,请双击文件夹列表中的样式表。

让已经起作用的部分css失效,可通过下面两种方法

一、重写元素样式

<style type="text/css">

/* 全局设置样式 */

a{color:#333text-decoration:none}/* 字体黑色,不带下划线 */

p{line-height:25pxcolor:#ccc}/* 行高25颜色灰 */

</style>

<div id="notice">

<a href="#">重写链接样式,颜色改为红,带下划线</a>

<p>重写此段落样式,颜色改为红,行高不变</p>

</div> <style type="text/css">

/* 将元素#notice重写样式 */

#notice a{color:redtext-decoration:underline}

#notice p{line-height:25pxcolor:red}

</style>

二、通过更改元素名称,来达到让此区域css失效的目的

如果我们已经为#notice设置了如上的单独样式,可以通过更改元素#notice的名称来取消样式

<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

<script type="text/javascript">

$(function() {

    $("#notice").attr("id", "notice00")

})

</script>

这时,notice已不存在,已经被修改成了notice00,其样式也就不存在了.

/// <summary>

/// 去除所有HTML标记

/// </summary>

public static string DeleteHtmlTag(string html)

{

html = Regex.Replace(html, @"<script[^>]*?>[\s\S]*?</script>", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"<style[^>]*?>[\s\S]*?</style>", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"<(.[^>]*)>", "",RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"([\r\n])[\s]+", "",RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"<!--(.*?)-->", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"“", "“", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"”", "”", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"&(.*?)", "", RegexOptions.IgnoreCase)

html = html.Replace("<", "")

html = html.Replace(">", "")

html = html.Replace("\r\n", "")

return html

}

/// <summary>

/// 去除脚本,样式,框架,事件等标记

/// </summary>

public static string DeleteAnyHtmlTag(string html)

{

html = Regex.Replace(html, @"<select[^>]*?>[\s\S]*?</select>", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"<script[^>]*?>[\s\S]*?</script>", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"<style[^>]*?>[\s\S]*?</style>", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"<iframe[^>]*?>[\s\S]*?</iframe>", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"<link[^>]*?>", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @"<input[^>]*?>", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @" id.*?=.*?""[^>]*?""", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @" class.*?=.*?""[^>]*?""", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @" style.*?=.*?""[^>]*?""", "", RegexOptions.IgnoreCase)

html = Regex.Replace(html, @" on.*?=.*?""[^>]*?""", "", RegexOptions.IgnoreCase)

return html

}