【CSS写法】超链接样式_html/css_WEB-ITnose
css a; 超链接
我们一般情况下写超链接时会用到,但是现在有个问题。描述如下:1.当的中间是文字时,带下划线显示。
2.当的之间是图片时,不带下划线显示。
现在想通过CSS式样控制一下,大牛们有没有什么好的方法。
回复讨论(解决方案)
a{ text-decoration:underline;}
当中间是文字会有下划线,为图片时没有
我看着这意思是,想要在都没有下划线或者都有下划线的意思吧?
都不出下划线的情况:
设置:
text-decoration:none;
都有下划线的情况:
这个得用border进行模拟了;
设置:
text-decoration:none;
border-bottom:1px soldi #000;
padding-bottom:2px;//为了border的显示更清晰。
试试看,颜色,border的样式(也可以用图片的哦),padding的大小,都可以更改的。
我看着这意思是,想要在都没有下划线或者都有下划线的意思吧?
都不出下划线的情况:
设置:
text-decoration:none;
都有下划线的情况:
这个得用border进行模拟了;
设置:
text-decoration:none;
border-bottom:1px soldi #000;
padding-bottom:2px;//为了border的显示更清晰。
试试看,颜色,border的样式(也可以用图片的哦),padding的大小,都可以更改的。
谢谢回复,差不多是这个意思。你的这个方法我也试过了。正因为这样,中间如果是图片的时候,也是显示出来的。我现在是想如果是文字的时候,下划线显示。如果是图片的时候,下划线不显示。
我觉得如果是文字的话里面可以在链接里面加一个span了,然后控制span的css。可以设置为:text-decoration:underline;图像的话就用
text-decoration:none;
border-bottom:1px soldi #000;
padding-bottom:2px;
。
我晕,我试了下不会出现你说的情况啊
不做处理,图片都没有下划线的。
我刚看了下W3C对text-decoration的说明:
text-decoration 属性规定添加到文本的修饰。
这个属性允许对文本设置某种效果,如加下划线。如果后代元素没有自己的装饰,祖先元素上设置的装饰会“延伸”到后代元素中。
这个属性只对文本有效啊?你是怎么出下划线的,能不能把代码贴出来给看看......
我晕,我试了下不会出现你说的情况啊
不做处理,图片都没有下划线的。
我刚看了下W3C对text-decoration的说明:
text-decoration 属性规定添加到文本的修饰。
这个属性允许对文本设置某种效果,如加下划线。如果后代元素没有自己的装饰,祖先元素上设置的装饰会“延伸”到后代元素中。
这个属性只对文本有效啊?你是怎么出下划线的,能不能把代码贴出来给看看......
我的网站是在IE11下,超链接的文字底部会被切除一部分。所以采用了下面的方法,这个方法你也提出过:
text-decoration:none;
border-bottom:1px soldi #000;
padding-bottom:2px;//为了border的显示更清晰。
但是如果向上面这样设置的话,超链接是图片时下面就会有线。
我觉得如果是文字的话里面可以在链接里面加一个span了,然后控制span的css。可以设置为:text-decoration:underline;图像的话就用
text-decoration:none;
border-bottom:1px soldi #000;
padding-bottom:2px;
。
我现在做的是维护项目,所以页面都已经写好了。现在浏览器升级到IE11的时候,超链接出现了问题。
所以像你所说的改法,估计改动范围比较大。所以不太可行。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.
