Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 772927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:52:55+00:00 2026-05-14T18:52:55+00:00

I am studying css and I do not understand why some OTHER text and

  • 0

I am studying css and I do not understand why some OTHER text and line 2 has red underline effect on them. I thought I either changed it for class others or reset it to none for class line2

I tried `text-decoration:none’ for both .line2 and .others and the text was still red underlined.

    <html>
    <head>
    <style type="text/css">
    .line {color:red; text-transform:uppercase; text-decoration:underline;}

    .line2 {color:blue; text-transform:none;}

    .others {color:black; text-transform:lowercase; text-decoration:blink; font-weight:bold;}
    </style>
    </head>

    <body>
    <div class='line'>
        line 1
        <div class='others'><BR>some OTHER text<BR></DIV>
        <div class='line2'>
            <BR>line 2
        </div>
    </div>
    </body>
    </html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:52:55+00:00Added an answer on May 14, 2026 at 6:52 pm

    It seems weird at first, but this behaviour is built into the CSS spec:

    This property is not inherited, but elements should match their parent. E.g., if an element is underlined, the line should span the child elements. The color of the underlining will remain the same even if descendant elements have different ‘color’ values.

    See http://www.w3.org/TR/REC-CSS1/#text-decoration.

    This is a kind of special inheritance, different to the standard CSS inheritance, which is why you can’t override it with other rules, more specific selectors, or !important.

    I’d guess it’s because text-decoration effects were originally designed to be applied to inline, not block elements. Imagine a link with a span inside it – it does make sense for the span to adopt the text-decoration properties of the parent link.

    There isn’t really a fix without adjusting the HTML. The easiest way to avoid the problem is to avoid setting text-decoration on blocks (especially ‘container’ blocks like your <div class="line">). I would use something like:

    <html>
    <head>
    <style type="text/css">
    .line {color:red; text-transform:uppercase; text-decoration:underline;}
    
    .line2 {color:blue; text-transform:none;}
    
    .others {color:black; text-transform:lowercase; text-decoration:blink; font-weight:bold;}
    </style>
    </head>
    
    <body>
    <div>
        <span class="line">line 1</span>
        <div class="others"><BR>some OTHER text<BR></DIV>
        <div class="line2">
            <BR>line 2
        </div>
    </div>
    </body>
    </html>
    

    Good find, though – it’s always good to learn something new!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Studying some code from a codeigniter tut, the following preg_match pattern has me baffled:
I'm currently studying Ubuntu Server administration, and also HTML/CSS. When it comes to the
While studying Java tutorials, Reflection and Late Binding have confused me. In some tutorials,
While studying the Collection API, we find that some methods ( add , remove
I was studying an open source code where I came across the following line
Hi my friend who's studying CSS wants to make a simple t-shirt catalog website.
I am studying the css reset of S. Meyer, found here: http://meyerweb.com/eric/tools/css/reset/ My question
i studying TDateTime functions and procedure, but not found something that allow me to
I am studying html, css, javascript and jquery in a very basic level yet,
My globalStyles.css has been stable for 3 weeks and is used everywhere in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.