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

  • Home
  • SEARCH
  • 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 8896543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:06:11+00:00 2026-06-15T00:06:11+00:00

I noticed this (oddity?) when playing around with code related to a:link around div

  • 0

I noticed this (oddity?) when playing around with code related to a:link around div – styling inside div

Given this HTML:

<a id="foo" href="foobar">
  <div id="bar">
    <h2 id="baz">Foo</h2>
  </div>
</a>

And this CSS (background colors added to show structure):

a {
  display: block;
  padding: 20px;
  background-color: rgb(240,240,240);
}

#bar {
  width: 200px;
  height: 100px;
  background-color: rgb(220,220,220);
}

#baz {
  padding: 20px;
  text-decoration: none;
}

Fiddle


Chrome shows the matched CSS rules as containing text-decoration: none; yet the text is indeed underlined:

Chrome Console
(source: pangram.net)


Similarly, using Firebug, Firefox returns null for the textDecoration computed style:

Firebug
(source: pangram.net)

MDN says that text-decoration applies to all elements.

I realize there’s an easy workaround of just applying the text-decoration property to the a link, but this is not the behavior I would have expected. Can anyone explain this (apparent) discrepancy?

Edit: I believe the answer is here: Line Decoration: Underline, Overline, and Strike-Through

When specified on or propagated to a block container that establishes
an inline formatting context, the decorations are propagated to an
anonymous inline box that wraps all the in-flow inline-level children
of the block container.

But I still don’t completely understand what’s going on.

  • 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-06-15T00:06:11+00:00Added an answer on June 15, 2026 at 12:06 am

    Chrome and Firefox underline hyperlinks by default, as you’re probably aware.

    What’s happening here is that while text-decoration gets computed to none on #baz (as specified in your CSS rule), the used value ends up being underline as a result of propagating the browser’s default style from its ancestor, the a element. This used value replaces the computed value when rendering the page onto the canvas, but as far as the DOM is concerned, the computed value remains none, based on cascade resolution alone.

    So, the discrepancy here lies in the difference between a computed value and a used value. The definitions can be found in section 6.1.

    This behavior of propagating text-decoration values into descendant boxes, which takes place independently of the cascade, is outlined here:

    When specified on or propagated to an inline element, it affects all the boxes generated by that element, and is further propagated to any in-flow block-level boxes that split the inline (see section 9.2.1.1).

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

Sidebar

Related Questions

I noticed this code when i was playing around with smallbasic showing it to
I noticed this accidentally when playing around in vimtutor. What's the difference between append
I noticed this while using Qt, going through the code examples. When they try
I noticed this situation in my code (unfortunately), and was able to duplicate it
I noticed this rule in Firebug: *|*:link { color:#0000EE; } I'm not sure that
Noticed this today. Given that a file named existing exists in the PWD of
I have noticed this piece of code: FileInfo[] files =new DirectoryInfo(@C:\).GetFiles(); What is the
I've noticed this question posed for a related problem with unit testing, but my
I noticed this piece of code in using CodeIgniter database migrations: $this->migrations->verbose AND print
I noticed this piece of code in Wordpress 2.9.1 (/wp-includes/compat.php), I don't understand it:

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.