如何将字符串设置为href样式 [英] How to style string as a href

查看:68
本文介绍了如何将字符串设置为href样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string link = "<a href= \"https://www.google.se\">https://www.google.se</a>";





我怎么样这个字符串=我想用它上面的颜色?



how could i style this string= i want to use color on it?

推荐答案

浏览器应自动为您设置链接样式。

有关锚点CSS样式的基础知识,请尝试http://www.w3schools.com/css/css_link.asp [ ^ ]。
The browser should automatically style the link for you.
For the basics on CSS styles for anchors, try http://www.w3schools.com/css/css_link.asp[^].


如果这是真正的锚点,你只需使用CSS来锚定伪类 a:链接 a:已访问,等等: http://www.w3schools.com/css/css_pseudo_classes.asp [ ^ ]。



尽量不要偏离普遍接受的样式:用户应该很容易识别链接。

CSS颜色属性是颜色背景颜色



如果你的意思是你不想放一个真正的锚,但是渲染显示锚语法的字符串,首先使用HTML 字符实体转义HTML http://www.w3schools.com/htmL/html_entities.asp [ ^ ]。



然后,按照自己喜欢的方式设计风格。如果您对CSS的工作方式有基本的了解(在问题标签中提到),您就知道该怎么做了。如果没有,请参阅此页面并通过此页面上的链接查找文档:

http://en.wikipedia。 org / wiki / Cascading_Style_Sheets [ ^ ]。 />


-SA
If this is real anchor, you just use CSS for anchor pseudo-classes, a:link, a:visited, and so on: http://www.w3schools.com/css/css_pseudo_classes.asp[^].

Try not to deviate from commonly accepted styles too far: the users should easily recognize links.
CSS color properties are color and background-color.

If you mean that you want to put not a real anchor, but render the strings showing the anchor syntax, first escape HTML using HTML character entities: http://www.w3schools.com/htmL/html_entities.asp[^].

And then, style it the way you like. If you have even the basic idea how CSS works (it is mentioned in your question tags), you know how to do it. If not, see this and find documentation by links on this page:
http://en.wikipedia.org/wiki/Cascading_Style_Sheets[^].

—SA


这篇关于如何将字符串设置为href样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆