CSS type selector overrides attribute selector?Set cellpadding and cellspacing in CSS?Which characters are valid in CSS class names/selectors?Is there a CSS parent selector?What does the “+” (plus sign) CSS selector mean?css selector to match an element without attribute xIs there a “previous sibling” CSS selector?When to use margin vs padding in CSSChange an HTML5 input's placeholder color with CSSCSS selector for first element with classIs it possible to apply CSS to half of a character?

Can compressed videos be decoded back to their uncompresed original format?

Alternative to sending password over mail?

Personal Teleportation: From Rags to Riches

How badly should I try to prevent a user from XSSing themselves?

Is there a hemisphere-neutral way of specifying a season?

How do conventional missiles fly?

Have there been efforts to prevent length extension attacks of hashing algorithms that are based on the Merkle–Damgård construction?

Theorists sure want true answers to this!

How painful is tzara'at

Can my sorcerer use a spellbook only to collect spells and scribe scrolls, not cast?

What does the expression "A Mann!" means

In Bayesian inference, why are some terms dropped from the posterior predictive?

Mathematica command that allows it to read my intentions

Using Advanced Custom Field (ACF) to insert meta description on each page

Why were 5.25" floppy drives cheaper than 8"?

Where would I need my direct neural interface to be implanted?

Which is the best way to check return result?

Processor speed limited at 0.4 GHz

Detention in 1997

Why can't we play rap on piano?

How to tell a function to use the default argument values?

Is it a bad idea to plug the other end of ESD strap to wall ground?

How do I deal with an unproductive colleague in a small company?

Hefsek between Karpas and maror?



CSS type selector overrides attribute selector?


Set cellpadding and cellspacing in CSS?Which characters are valid in CSS class names/selectors?Is there a CSS parent selector?What does the “+” (plus sign) CSS selector mean?css selector to match an element without attribute xIs there a “previous sibling” CSS selector?When to use margin vs padding in CSSChange an HTML5 input's placeholder color with CSSCSS selector for first element with classIs it possible to apply CSS to half of a character?













1















Generally speaking, an attribute selector has higher specificity than a type selector, but in the image below, the type selector wins (margin is set to 0)?



Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?



enter image description here










share|improve this question



















  • 1





    instead of a screenshot share a code that reproduce this so we can better see.

    – Temani Afif
    Mar 8 at 21:41






  • 1





    Please include a Minimal, Complete, and Verifiable example of the relevant code in the question itself.

    – TylerH
    Mar 8 at 21:41






  • 2





    "Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?" Yes. The concept in the cascade that's relevant here is the origin

    – Alohci
    Mar 8 at 23:31











  • @Alohci If you could post that as an answer, the OP could accept it.

    – Mr Lister
    Mar 9 at 8:46











  • @TylerH: It's not possible to provide one given that part of the code that's required is coming internally from the UA. A Stack Snippet with just the button, input, optgroup, select, textarea CSS rule by itself is not terribly clear as an MCVE as readers would still need to do the manual work (God forbid) of opening their Chrome dev tools. Alternatively it could include the UA styles ahead of the author styles to simulate the cascading order, but that would not even be Verifiable because then you're just comparing two author-level rules.

    – BoltClock
    Mar 16 at 6:08
















1















Generally speaking, an attribute selector has higher specificity than a type selector, but in the image below, the type selector wins (margin is set to 0)?



Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?



enter image description here










share|improve this question



















  • 1





    instead of a screenshot share a code that reproduce this so we can better see.

    – Temani Afif
    Mar 8 at 21:41






  • 1





    Please include a Minimal, Complete, and Verifiable example of the relevant code in the question itself.

    – TylerH
    Mar 8 at 21:41






  • 2





    "Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?" Yes. The concept in the cascade that's relevant here is the origin

    – Alohci
    Mar 8 at 23:31











  • @Alohci If you could post that as an answer, the OP could accept it.

    – Mr Lister
    Mar 9 at 8:46











  • @TylerH: It's not possible to provide one given that part of the code that's required is coming internally from the UA. A Stack Snippet with just the button, input, optgroup, select, textarea CSS rule by itself is not terribly clear as an MCVE as readers would still need to do the manual work (God forbid) of opening their Chrome dev tools. Alternatively it could include the UA styles ahead of the author styles to simulate the cascading order, but that would not even be Verifiable because then you're just comparing two author-level rules.

    – BoltClock
    Mar 16 at 6:08














1












1








1








Generally speaking, an attribute selector has higher specificity than a type selector, but in the image below, the type selector wins (margin is set to 0)?



Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?



enter image description here










share|improve this question
















Generally speaking, an attribute selector has higher specificity than a type selector, but in the image below, the type selector wins (margin is set to 0)?



Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?



enter image description here







css css-selectors css-specificity






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 21:41









TylerH

16.1k105569




16.1k105569










asked Mar 8 at 21:38









Zico DengZico Deng

3318




3318







  • 1





    instead of a screenshot share a code that reproduce this so we can better see.

    – Temani Afif
    Mar 8 at 21:41






  • 1





    Please include a Minimal, Complete, and Verifiable example of the relevant code in the question itself.

    – TylerH
    Mar 8 at 21:41






  • 2





    "Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?" Yes. The concept in the cascade that's relevant here is the origin

    – Alohci
    Mar 8 at 23:31











  • @Alohci If you could post that as an answer, the OP could accept it.

    – Mr Lister
    Mar 9 at 8:46











  • @TylerH: It's not possible to provide one given that part of the code that's required is coming internally from the UA. A Stack Snippet with just the button, input, optgroup, select, textarea CSS rule by itself is not terribly clear as an MCVE as readers would still need to do the manual work (God forbid) of opening their Chrome dev tools. Alternatively it could include the UA styles ahead of the author styles to simulate the cascading order, but that would not even be Verifiable because then you're just comparing two author-level rules.

    – BoltClock
    Mar 16 at 6:08













  • 1





    instead of a screenshot share a code that reproduce this so we can better see.

    – Temani Afif
    Mar 8 at 21:41






  • 1





    Please include a Minimal, Complete, and Verifiable example of the relevant code in the question itself.

    – TylerH
    Mar 8 at 21:41






  • 2





    "Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?" Yes. The concept in the cascade that's relevant here is the origin

    – Alohci
    Mar 8 at 23:31











  • @Alohci If you could post that as an answer, the OP could accept it.

    – Mr Lister
    Mar 9 at 8:46











  • @TylerH: It's not possible to provide one given that part of the code that's required is coming internally from the UA. A Stack Snippet with just the button, input, optgroup, select, textarea CSS rule by itself is not terribly clear as an MCVE as readers would still need to do the manual work (God forbid) of opening their Chrome dev tools. Alternatively it could include the UA styles ahead of the author styles to simulate the cascading order, but that would not even be Verifiable because then you're just comparing two author-level rules.

    – BoltClock
    Mar 16 at 6:08








1




1





instead of a screenshot share a code that reproduce this so we can better see.

– Temani Afif
Mar 8 at 21:41





instead of a screenshot share a code that reproduce this so we can better see.

– Temani Afif
Mar 8 at 21:41




1




1





Please include a Minimal, Complete, and Verifiable example of the relevant code in the question itself.

– TylerH
Mar 8 at 21:41





Please include a Minimal, Complete, and Verifiable example of the relevant code in the question itself.

– TylerH
Mar 8 at 21:41




2




2





"Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?" Yes. The concept in the cascade that's relevant here is the origin

– Alohci
Mar 8 at 23:31





"Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?" Yes. The concept in the cascade that's relevant here is the origin

– Alohci
Mar 8 at 23:31













@Alohci If you could post that as an answer, the OP could accept it.

– Mr Lister
Mar 9 at 8:46





@Alohci If you could post that as an answer, the OP could accept it.

– Mr Lister
Mar 9 at 8:46













@TylerH: It's not possible to provide one given that part of the code that's required is coming internally from the UA. A Stack Snippet with just the button, input, optgroup, select, textarea CSS rule by itself is not terribly clear as an MCVE as readers would still need to do the manual work (God forbid) of opening their Chrome dev tools. Alternatively it could include the UA styles ahead of the author styles to simulate the cascading order, but that would not even be Verifiable because then you're just comparing two author-level rules.

– BoltClock
Mar 16 at 6:08






@TylerH: It's not possible to provide one given that part of the code that's required is coming internally from the UA. A Stack Snippet with just the button, input, optgroup, select, textarea CSS rule by itself is not terribly clear as an MCVE as readers would still need to do the manual work (God forbid) of opening their Chrome dev tools. Alternatively it could include the UA styles ahead of the author styles to simulate the cascading order, but that would not even be Verifiable because then you're just comparing two author-level rules.

– BoltClock
Mar 16 at 6:08













1 Answer
1






active

oldest

votes


















1















Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?




Yes. The technical name for "custom CSS" is author-level CSS as detailed in this section of the spec. Specificity is only relevant when you're comparing two CSS rules that have the same origin, either two UA styles or two author styles.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071360%2fcss-type-selector-overrides-attribute-selector%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1















    Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?




    Yes. The technical name for "custom CSS" is author-level CSS as detailed in this section of the spec. Specificity is only relevant when you're comparing two CSS rules that have the same origin, either two UA styles or two author styles.






    share|improve this answer



























      1















      Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?




      Yes. The technical name for "custom CSS" is author-level CSS as detailed in this section of the spec. Specificity is only relevant when you're comparing two CSS rules that have the same origin, either two UA styles or two author styles.






      share|improve this answer

























        1












        1








        1








        Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?




        Yes. The technical name for "custom CSS" is author-level CSS as detailed in this section of the spec. Specificity is only relevant when you're comparing two CSS rules that have the same origin, either two UA styles or two author styles.






        share|improve this answer














        Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?




        Yes. The technical name for "custom CSS" is author-level CSS as detailed in this section of the spec. Specificity is only relevant when you're comparing two CSS rules that have the same origin, either two UA styles or two author styles.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 16 at 6:13









        BoltClockBoltClock

        529k13011721208




        529k13011721208





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071360%2fcss-type-selector-overrides-attribute-selector%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme