- Next.js Guide: Removing Text Decoration in Your Text Messages
- How to remove underline from link in nextjs
- Can’t remove Link hover underline
- Text Decoration: None !important not working
- How to style Link component when on active page on Next.js
- Style textDecoration Property
- Browser Support
- Syntax
- Property Values
- Technical Details
- More Examples
- Example
- Related Pages
- COLOR PICKER
- Report Error
- Thank You For Helping Us!
- text-decoration
- Try it
- Constituent properties
- Syntax
- Values
- Formal definition
- Formal syntax
- Examples
- Demonstration of text-decoration values
- Result
- Specifications
- Browser compatibility
- See also
- Found a content problem with this page?
- MDN
- Support
- Our communities
- Developers
- textDecoration style property
- Syntax:
- Possible values:
- Description of values:
- Example HTML code 1:
- Example HTML code 2:
- Supported by objects:
- Browser Support
- CSS Syntax
- Property Values
- More Examples
- Example
- Related Pages
- COLOR PICKER
- Report Error
- Thank You For Helping Us!
Next.js Guide: Removing Text Decoration in Your Text Messages
Solution: To resolve the issue, try adding the following two things. Firstly, change the import of the App.css file from [react link underline] to [react link no-underline]. Secondly, apply the CSS property you want to use on the [active link] not the [inactive link]. Adding this CSS at the end of the file should fix the issue. Solution: By default, Next.js does not add [underline] to your active link. However, you can create a custom [link] component that checks if the current [page] is the same as the [link] prop. Then, you can use this component instead of the default [link] whenever you want to add [underline] to the active link.
How to remove underline from link in nextjs
Can’t remove Link hover underline
import React, < Component >from 'react'; import < Link >from 'react-router-dom'; import styled from 'styled-components'; const StyledLink = styled(Link)` text-decoration: none; &:focus, &:hover, &:visited, &:link, &:active < text-decoration: none; >`; export default (props) => ="">;
Text-decoration-line — CSS: Cascading Style Sheets, 6 days ago · The text-decoration-line property is specified as none , or one or more space-separated values from the list below. Values. none. Produces no
Text Decoration: None !important not working
Firstly, it is necessary to modify the import statement for the App.css file.
Specify the desired CSS property as text-decoration instead of text-decoration-style , and indicate that it should be applied to anchor rather than list item .
appending the given CSS code to the App.css file resolves the problem.
How to remove text-decoration from React ?, .header__links a < text-decoration: none; >should work. Inside .header__links there is an a element. This element have some default styles
How to style Link component when on active page on Next.js
While using Next.js, the active link won’t contain aria-current . But, you can develop a personalized Link component that verifies whether the current pathname matches the href property.
import React from "react"; import Link from "next/link"; import < useRouter >from "next/router"; const NavLink = (< children, href >) => < const child = React.Children.only(children); const router = useRouter(); return ( " /> )> ); >; export default NavLink;
Substitute the standard Link with this module to include aria-current in the live hyperlink whenever needed.
const NavStyle = styled.nav` display: flex; justify-content: space-between; a < background-color: #353637; color: #fff; padding: 1rem; text-decoration: none; &[aria-current] < background-color: #faf9f4; color: #353637; >> `; export default function Nav() < return ( HOME PRICING TERMS LOGIN LOGO ); >
Reactjs — Can’t remove Link hover underline, Create a custom Link component that wraps the Next.js Link and styles it as you want, then use that instead across your app. – juliomalves
Style textDecoration Property
The textDecoration property sets or returns one ore more decorations for a text.
Tip: To specify more than one decoration type for an element, specify a space separated list of decoration types.
Browser Support
Syntax
Return the textDecoration property:
Set the textDecoration property:
Property Values
Value | Description |
---|---|
none | Defines a normal text. This is default |
underline | Defines a line under the text |
overline | Defines a line over the text |
line-through | Defines a line through the text |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
Default Value: | none |
---|---|
Return Value: | A String, representing the decoration added to the text |
CSS Version | CSS1 |
More Examples
Example
Return the text decoration of an element:
Related Pages
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.
text-decoration
The text-decoration shorthand CSS property sets the appearance of decorative lines on text. It is a shorthand for text-decoration-line , text-decoration-color , text-decoration-style , and the newer text-decoration-thickness property.
Try it
Text decorations are drawn across descendant text elements. This means that if an element specifies a text decoration, then a child element can’t remove the decoration. For example, in the markup
This text has some emphasized words in it.
, the style rule p < text-decoration: underline; >would cause the entire paragraph to be underlined. The style rule em < text-decoration: none; >would not cause any change; the entire paragraph would still be underlined. However, the rule em < text-decoration: overline; >would cause a second decoration to appear on «some emphasized words».
Constituent properties
This property is a shorthand for the following CSS properties:
Syntax
text-decoration: underline; text-decoration: overline red; text-decoration: none; /* Global values */ text-decoration: inherit; text-decoration: initial; text-decoration: revert; text-decoration: revert-layer; text-decoration: unset;
The text-decoration property is specified as one or more space-separated values representing the various longhand text-decoration properties.
Values
Sets the kind of decoration used, such as underline or line-through .
Sets the color of the decoration.
Sets the style of the line used for the decoration, such as solid , wavy , or dashed .
Sets the thickness of the line used for the decoration.
Formal definition
- text-decoration-color : currentcolor
- text-decoration-style : solid
- text-decoration-line : none
- text-decoration-line : as specified
- text-decoration-style : as specified
- text-decoration-color : computed color
- text-decoration-thickness : as specified
- text-decoration-color : a color
- text-decoration-style : discrete
- text-decoration-line : discrete
- text-decoration-thickness : by computed value type
Formal syntax
Examples
Demonstration of text-decoration values
.under text-decoration: underline red; > .over text-decoration: wavy overline lime; > .line text-decoration: line-through; > .plain text-decoration: none; > .underover text-decoration: dashed underline overline; > .thick text-decoration: solid underline purple 4px; > .blink text-decoration: blink; >
p class="under">This text has a line underneath it.p> p class="over">This text has a line over it.p> p class="line">This text has a line going through it.p> p> This a class="plain" href="#">link will not be underlineda>, as links generally are by default. Be careful when removing the text decoration on anchors since users often depend on the underline to denote hyperlinks. p> p class="underover">This text has lines above em>andem> below it.p> p class="thick"> This text has a really thick purple underline in supporting browsers. p> p class="blink"> This text might blink for you, depending on the browser you use. p>
Result
Specifications
Browser compatibility
BCD tables only load in the browser
See also
- The individual text-decoration properties are text-decoration-line , text-decoration-color , text-decoration-style , and text-decoration-thickness .
- The text-decoration-skip-ink , text-underline-offset , and text-underline-position properties also affect text-decoration, but are not included in the shorthand.
- The list-style attribute controls the appearance of items in HTML and lists.
Found a content problem with this page?
This page was last modified on Apr 20, 2023 by MDN contributors.
Your blueprint for a better internet.
MDN
Support
Our communities
Developers
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998– 2023 by individual mozilla.org contributors. Content available under a Creative Commons license.
textDecoration style property
Specifies or returns the appearance characteristics of text, whether it is underlined, overlined, lined-through or blinking text.
You can specify a space separated list of decoration types, if you want to use more than one for an element.
Syntax:
Possible values:
Description of values:
Use default anchor decoration. |
The text content of the element blinks. |
Takes the value of this property from the computed style of the parent element. |
The text content of the element is displayed with a line through the middle. |
No text decoration is used. |
The text content of the element is displayed with a line at the top. |
The text content of the element is underlined. |
Example HTML code 1:
head> style> .example text-decoration: overline line-through; > style> head> body> a class="example">Text decoration: overline line-throughp> body>
Example HTML code 2:
head> script type="text/javascript"> function ChangeTextDecoration (elem) var anchor = document.getElementById ("myAnchor"); var checkboxes = document.getElementsByName ("checkboxs"); var decorValue = ""; // Checks all checkbox state for (var i = 0; i < checkboxes.length; i++) if (checkboxes[i].checked) < decorValue += checkboxes[i].value + " "; > > // If none is checked all other checked out var noneCh = document.getElementsByName("nonecheck"); if (noneCh[0].checked) for (var i = 0; i < checkboxes.length; i++) < checkboxes[i].checked = false; > decorValue = "none"; > anchor.style.textDecoration = decorValue; > script> head> body> a id="myAnchor">Text decoration samplea> br />br /> Change text-decoration value: br /> input type="checkbox" name="checkboxs" value="blink" onclick="ChangeTextDecoration ();"/>blinkbr /> input type="checkbox" name="checkboxs" value="line-through" onclick="ChangeTextDecoration ();"/>line-throughbr /> input type="checkbox" name="checkboxs" value="overline" onclick="ChangeTextDecoration ();"/>overlinebr /> input type="checkbox" name="checkboxs" value="underline" onclick="ChangeTextDecoration ();"/>underlinebr /> input type="checkbox" name="nonecheck" onclick="ChangeTextDecoration ();" />none body>
Supported by objects:
Set different text decorations for , , and elements:
The text-decoration property specifies the decoration added to text, and is a shorthand property for:
- text-decoration-line (required)
- text-decoration-color
- text-decoration-style
- text-decoration-thickness
Default value: | none currentColor solid auto |
---|---|
Inherited: | no |
Animatable: | no, see individual properties. Read about animatable |
Version: | CSS1, renewed in CSS3 |
JavaScript syntax: | object.style.textDecoration=»underline» Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
CSS Syntax
text-decoration: text-decoration-line text-decoration-color text-decoration-style text-decoration-thickness|initial|inherit;
Property Values
Value | Description | Demo |
---|---|---|
text-decoration-line | Sets the kind of text decoration to use (like underline, overline, line-through) | Demo ❯ |
text-decoration-color | Sets the color of the text decoration | Demo ❯ |
text-decoration-style | Sets the style of the text decoration (like solid, wavy, dotted, dashed, double) | Demo ❯ |
text-decoration-thickness | Sets the thickness of the decoration line | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
More Examples
Example
h1 <
text-decoration: underline overline dotted red;
>
h2 text-decoration: underline wavy blue 5px;
>
Related Pages
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.