- CSS Link Styling
- Styling Text Links
- Styling Image Links
- Styling Block Links
- a:link , a:visited , a:hover , a:active
- Styling Links As Buttons
- Css how to make links bold in css
- How to Style Links?
- Styling links according to states
- How to remove the default underline from hperlinks
- Links as Buttons
- Conclusion
- How to Bold Text in CSS and HTML
- Styling Hyperlinks with CSS
- How to make a link bold and underlined on hover?
- How do you make a:visited bold in XHTML/CSS?
- How to bold active links in ui-router
- CSS Links
- Styling Links
- Example
- Example
- Text Decoration
- Example
- Background Color
- Example
- Link Buttons
- Example
- More Examples
- Example
- Example
- Example
- COLOR PICKER
- Report Error
- Thank You For Helping Us!
CSS Link Styling
You can style HTML links ( a elements) using CSS properties and CSS selectors. HTML links can be either text links, image links or block links ( a block of HTML ). Here are three HTML link examples:
The first a element is a text link because the a element body just contains text.
The second a element is an image link because the a element body just contains an img element.
The third a element is a block link because the a element body contains a block of HTML. Block links have not always been supported by the browsers, but at the time of writing they work in most browsers (if not all).
Styling Text Links
Text links can be styled using all of the CSS text styling properties. That means that you can set the font-family , font-size , font-weight , color , text-decoration etc. of text links. Here is a text link CSS styling example:
This example CSS rule sets the font-family to Helvetica , sets the font-size to 1em , sets the font-weight to bold , the color to #000099 (darker blue), and removes the default underlining, for all a elements.
Here is how a text link looks with these styles applied:
Styling Image Links
When a link contains an image you can style either the a element or the img element. Images can be styled using any of the standard image styling CSS properties.
Styling Block Links
When you style block links you typically style the HTML inside the a element, and not the a element itself.
a:link , a:visited , a:hover , a:active
a:link < color: #00ff00; >a:visited < color: #009900; >a:hover < color: #66ff66; >a:active
Styling Links As Buttons
You can style a link to look like a button. You do so by setting the border , background-color , color and padding CSS properties, in addition to the text properties. Here is an example:
a.greenButton < border: 2px solid #006600; background-color: #009900; color: #ffffff; text-decoration: none; margin : 20px; padding: 10px 20px 10px 20px; display: inline-block; >a.greenButton:hover
Here is how a text link looks with these styles applied:
Notice how the button changes color when you hover the mouse over it.
You can also make the corners round with the border-radius CSS property. Here is a code example:
a.greenButtonRound < border: 2px solid #006600; border-radius: 5px; background-color: #009900; color: #ffffff; font-weight: bold; text-decoration: none; margin : 20px; padding: 10px 20px 10px 20px; display: inline-block; >a.greenButtonRound:hover
And here is what the button looks like with rounded corners (and bold text):
Css how to make links bold in css
Links are entities that indicate new locations. These hyperlinks or links play a vital role in websites when you want your users to visit other content available online. These either denote content available within the same website or content available on other websites. Now we know how significant it is to make your website look visually pleasing, therefore, styling hyperlinks is as important as styling any other element on your website. You must be pondering how to do that. Well, hold on tight because this post will guide you all about styling links.
How to Style Links?
Links or hyperlinks on a website can be styled using various CSS properties. Styling links can include changing their color, font size, font family, etc.
Example
Suppose you want that a hyperlink on your website should have a bold style and its color should be green. Use the following piece of code.
The color and the font-weight of the link have been changed successfully.
Styling links according to states
Links displayed on a website have different states and they can be styled based on their current state. The different states that a link can have are;
a:link (a link that has not yet been visited by the user)
a:visited (a link that has been visited by the user)
a:hover (the state of the link when a mouse cursor is moved over the link)
a:active (the state of the link when user clicks on the link)
Styling links according to their states is necessary because they let the user understand the condition of a link and prevent the user from facing any confusion.
Example
Use the following code snippet to style links on your website according to their state.
- When the link is not visited by the user yet.
- When the user visits the link.
- When user brings the mouse over the link.
- When the user clicks on the link.
Note: When styling multiple links, maintain the above-mentioned order so that your links behave accordingly. Let’s suppose you style hover first instead of styling visited then the style defined for visited will override hover style and this is a situation that one must avoid.
How to remove the default underline from hperlinks
By default there is an underline on links in a website which can sometimes be unwanted. You can get rid of the underline from links using the text-decoration property of CSS. The following code snippet shows how it can be done.
In the above example, the default underline is being removed from an unvisited link by setting the value of the text-decoration property to “none”. You can use the above code snippet to remove an underline from other states of a link as well.
The default underline is successfully removed from the unvisited link.
Links as Buttons
Sometimes the usual text links appearing on a website can be boring, therefore, in order to make them more attractive, you can make links appear as buttons on your website. Making links as buttons utilizes multiple CSS properties such as padding, border, background-color, etc.
The example below illustrates how you use links as buttons.
a : hover , a : active <
background-color : red ;
>
In the above code snippet, a link is being displayed as a button. The unvisited and visited states of the button are being styled differently from the hover and active states of the link.
- The unvisited and visited state of the button link.
- The hover and active states of the button link.
A link in all of its states is designed successfully as a button.
Conclusion
Styling links or hyperlinks on a website is as equally important as styling any other element. For the purpose of styling links, various CSS properties are used such as color, background-color, font-family, font-style, etc. Links can also be styled according to their states which are unvisited, visited, hover, and active, moreover, to enhance the look of links appearing on websites, you can use links as buttons. This write-up discusses how to style links using css in depth with the help of appropriate examples.
How to Bold Text in CSS and HTML, Learn How to Bold Text in CSS. In this video im going to walk you through how to bold text Duration: 2:11
How to Bold Text in CSS and HTML
Learn How to Bold Text in CSS. In this video im going to walk you through how to bold text Duration: 2:11
Styling Hyperlinks with CSS
Use CSS stylesheets to modify hyperlinks. Change characteristics for new links, visited Duration: 9:31
How to make a link bold and underlined on hover?
You need to use the :hover selector
target the hover state on the a or add a class if you want to target a specific link
This code appear for all the links
If u want only for the menu just go with this
How to Style Links Using CSS?, Suppose you want that a hyperlink on your website should have a bold style and its color should be green. Use the following piece of code.
How do you make a:visited bold in XHTML/CSS?
Ah — I believe this won’t work in recent browsers, because they disabled most styles for visited links to prevent websites from detecting the user’s web browsing history:
For example, in Chrome 15, the visited link on this fiddle has a different colour, but is not bold:
Looks like Firefox added this in version 4:
The reason it didn’t work before is because space is a descendent selector: http://www.w3.org/TR/CSS2/selector.html#descendant-selectors
A descendant selector is made up of two or more selectors separated by white space. A descendant selector of the form «A B» matches when an element B is an arbitrary descendant of some ancestor element A.
These kinds of CSS selector need to be attached to what it’s referring to, such as: a:visited
The Strong Importance element — HTML: HyperText Markup Language, Typically this element is rendered by default using a bold font weight. However, it should not be used to apply bold styling; use the CSS font-
How to bold active links in ui-router
ui-sref-active adds a class, your css targets the ‘:active’ pseudoclass. use a.active in your css.
How to Bold Text in CSS, We can make our text bold by applying the CSS “font-weight” property and setting it “bold”. We can also set some numeric values or the “bolder” keyword for this
CSS Links
With CSS, links can be styled in many different ways.
Styling Links
Links can be styled with any CSS property (e.g. color , font-family , background , etc.).
Example
In addition, links can be styled differently depending on what state they are in.
The four links states are:
- a:link — a normal, unvisited link
- a:visited — a link the user has visited
- a:hover — a link when the user mouses over it
- a:active — a link the moment it is clicked
Example
/* unvisited link */
a:link color: red;
>
/* visited link */
a:visited color: green;
>
/* mouse over link */
a:hover color: hotpink;
>
/* selected link */
a:active color: blue;
>
When setting the style for several link states, there are some order rules:
Text Decoration
The text-decoration property is mostly used to remove underlines from links:
Example
a:visited text-decoration: none;
>
a:hover text-decoration: underline;
>
a:active text-decoration: underline;
>
Background Color
The background-color property can be used to specify a background color for links:
Example
a:link <
background-color: yellow;
>
a:visited background-color: cyan;
>
a:hover background-color: lightgreen;
>
a:active background-color: hotpink;
>
Link Buttons
This example demonstrates a more advanced example where we combine several CSS properties to display links as boxes/buttons:
Example
a:link, a:visited <
background-color: #f44336;
color: white;
padding: 14px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
>
a:hover, a:active background-color: red;
>
More Examples
Example
This example demonstrates how to add other styles to hyperlinks:
Example
Another example of how to create link boxes/buttons:
a:link, a:visited <
background-color: white;
color: black;
border: 2px solid green;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
>
a:hover, a:active background-color: green;
color: white;
>
Example
This example demonstrates the different types of cursors (can be useful for links):
COLOR PICKER
Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top References
Top Examples
Get Certified
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.