increase font size of hyperlink text html

蹲街弑〆低调 提交于 2019-12-04 08:10:03

问题


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.

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?


回答1:


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.




回答2:


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 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:

<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.

Example:

<a href="selectTopic?html" class="topic">HTML 5</a>

CSS:

.topic { font-size: 100px; text-decoration: none; }



回答3:


you can add class in anchor tag also like below

.a_class {font-size: 100px} 



回答4:


There is a way simpler way. You put the href in a paragraph just created for that href. For example:

HREF name



来源:https://stackoverflow.com/questions/15175312/increase-font-size-of-hyperlink-text-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!