【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











The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

The article discusses the differences between HTML tags , , , and , focusing on their semantic vs. presentational uses and their impact on SEO and accessibility.
