Html 增加超链接文本html的字体大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15175312/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
increase font size of hyperlink text html
提问by Aniket
I am working on web application where I have taken href. But the default font of it is too small when comparing to the page. So I want to increase the size of the font.
我正在开发我使用href 的网络应用程序。但是与页面相比,它的默认字体太小了。所以我想增加字体的大小。
My output page look like below:
我的输出页面如下所示:
I have tried by font size for anchor tag but it doesn't show any effect after the font tag.
我已经尝试过锚标签的字体大小,但在字体标签后没有显示任何效果。
Code I have tried is:
我试过的代码是:
<font size="100px"><a href="selectTopic?html" style="text-decoration: none">HTML 5</a></font>
So how can I change the font size?
那么如何更改字体大小呢?
回答by Eli
You can do like this:
你可以这样做:
a {font-size: 100px}
Try avoid using font tag because it's deprecated. Use CSS like above instead. You can give your anchors specific class and apply any style for them.
尽量避免使用字体标签,因为它已被弃用。改用上面的 CSS。您可以为锚点指定特定的类并为它们应用任何样式。
回答by Guffa
Your font
tag is not correct, so it won't work in some browsers. The px
unit is used with CSS, not HTML attributes. The font tag should look like this:
您的font
标签不正确,因此在某些浏览器中无法使用。该px
单元与 CSS 一起使用,而不是与 HTML 属性一起使用。字体标签应如下所示:
<font size="100">
Well, actually it shouldn't be there at all. The font
tag is deprecated, you should use CSS to style the content, like you do already with the text-decoration
:
嗯,实际上它根本不应该在那里。该font
标签已被弃用,你应该使用CSS样式的内容,就像你与已经做text-decoration
:
<a href="selectTopic?html" style="font-size: 100px; text-decoration: none">HTML 5</a>
To separate the content from the styling, you should of course work towards putting the CSS in a style sheet rather than as inline style
attributes. That way you can apply one style to several elements without having to put the same style
attribute in all of them.
要将内容与样式分开,您当然应该努力将 CSS 放在样式表中,而不是作为内联style
属性。这样您就可以将一种样式应用于多个元素,而不必style
在所有元素中放置相同的属性。
Example:
例子:
<a href="selectTopic?html" class="topic">HTML 5</a>
CSS:
CSS:
.topic { font-size: 100px; text-decoration: none; }
回答by www.wishinfo.net
you can add class in anchor tag also like below
您也可以在锚标记中添加类,如下所示
.a_class {font-size: 100px}
回答by Web Coder
There is a way simpler way. You put the href in a paragraph just created for that href. For example:
有一种更简单的方法。您将 href 放在刚刚为该 href 创建的段落中。例如:
HREF name
HREF 名称