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









        BoltClock♦BoltClock

        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

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

            Posting a File and Associated Data to a RESTful WebService preferably as JSON2019 Community Moderator ElectionREST URI convention - Singular or plural name of resource while creating itUploading both data and files in one form using Ajax?How do I upload a file with metadata using a REST web service?REST API - file (ie images) processing - best practicesSpring: JSON data and file in the same requestREST API Put large dataPosting a file and JSON data to Spring rest serviceRESTful Web Service Upload/Download Large Data With JSONREST API Design sending JSON data and a file to the api in same requestPost JSONArray to REST servicePUT vs. POST in RESTParsing values from a JSON file?JavaScript/jQuery to download file via POST with JSON dataHow do I upload a file with metadata using a REST web service?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?Separate REST JSON API server and client?what's the correct way to send a file from REST web service to client?How do I write JSON data to a file?What is “406-Not Acceptable Response” in HTTP?REST API - file (ie images) processing - best practices

            How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page