Reset de todas las propiedades CSS de selectores con una sola propiedad: all

9/Nov/2018 45

Existe una propiedad CSS que remueve toda propiedad CSS aplicada por el browser a un selector y la deja sin nada, desnuda y cruda. No me refiero a un reseter, menos a un normalizer. La propiedad all: unset; aplicada a un selector, por ejemplo, un <input />, <button>, <select> y muchos otros que tienen diferencias de render entre browsers, puedes remover todo estilo aplicado por defecto y crear los tuyos de cero sin tener que sobre-escribirlos.

Un ejemplo a continuación con los siguientes elementos HTML:

<button>button</button>
<input type="text" value="input">
<select>
  <option>select</option>
</select>
<a href="#">link</a>

See the Pen Example 1: CSS `all: unset` property / value by Jorge Epuñan (@juanbrujo) on CodePen.

Crearemos una clase CSS para aplicar el estilo a las etiquetas y ver el resultado esperado:

.unstyle {
  all: unset;
}

See the Pen Example 2: CSS `all: unset` property / value by Jorge Epuñan (@juanbrujo) on CodePen.

Al aplicar all: unset; todo parece similar, solo texto los cuales puedes aún interactuar (button, input, select y link (si tuvieran algo). Ahora podemos crear estilos base para, por ejemplo, .button donde el mismo estilo se aplique a todas las etiquetas que tengan esta clase:

See the Pen Example 3: CSS `all: unset` property / value by Jorge Epuñan (@juanbrujo) on CodePen.

Como observan, no necesitamos quitar el text-decoration: underline; del <a>o el border: 0; del <button>, simplemente escribimos el CSS que queremos para cualquier etiqueta que necesitamos se comporte como un botón.

Últimas observaciones

Como consejo, no se les ocurra utilizar esta propiedad como su nuevo reseter / normalizar o algo por el estilo:

body {
  all: unset;
  ...
}

Esta propiedad es para situaciones puntuales, como las que acabo de mostrar. Quizás para listas (ordenadas, desordenadas o de definición) y algunos otros elementos puntuales. Quizás sea útil para crear componentes de vista (UI components) en sus propias guías de estilos.

Soporte:

A la fecha de publicado este artículo no se ve mal:

Link:

Comentarios

  1. indirmeden [#]

    Greate article. Keep posting such kind of info on your page. Im really impressed by your blog. Renata Micheil Elwina

  2. erotik [#]

    Way cool! Some extremely valid points! I appreciate you writing this article and also the rest of the site is really good.| Adda Arlan Ful

  3. turkce [#]

    This can be a set of words, not an essay. that you are incompetent Lydie Randal Corene

  4. turkce [#]

    Having read this I thought it was extremely enlightening. I appreciate you taking the time and energy to put this informative article together. I once again find myself spending a significant amount of time both reading and commenting. But so what, it was still worth it! June Rowan Monto

  5. turkce [#]

    Today, there are actually many nationwide relocating providers and far away moving companies around the United States involving various sizes and shapes. In small towns and areas, family-operated relocating firms are rather prominent. This is actually mostly since they individually recognize the owners and understand that they can place leave on their relocation companies. Having said that, a lot of our company must take care of finding good quality best-rated nationally moving companies to hire from square one. Mirabelle Che Naples

  6. turkce [#]

    Buna ziua, puteti repeta procedura, insa trebuie sa aveti in vedere ca acest lucru s-a intamplat pentru ca, clatirea nu a fost facuta conform cu recomandarile din instructiuni. Va rugam sa treceti prin fiecare pas cu timpii indicati. O zi frumoasa. Martha Arney Utter

  7. turkce [#]

    Oh wow! Can you imagine that being your School! Amazing building. Thanks forsharing Gloriana Arvy Lundeen

  8. turkce [#]

    Please keep throwing these posts up they help tons. Lacee Ritchie Christoffer

  9. turkce [#]

    I think this is a real great post. Thanks Again. Cool. Laura Jeffy Haimes

  10. turkce [#]

    Hiya, I am really glad I have found this info. Today bloggers publish only about gossip and web stuff and this is really frustrating. A good website with interesting content, this is what I need. Thank you for making this web site, and I will be visiting again. Do you do newsletters by email? Tarra Joe Chapnick

  11. turkce [#]

    I would like to save all my blog posts on wordpress ? Nadiya Warden Aggi

  12. turkce [#]

    Dank Dies ist ein sehr guter Artikel!. Ich mag Deine Webseite! Kipp Sauncho Vena

  13. turkce [#]

    But wanna tell that this is invaluable , Thanks for taking your time to write this. Saba Benjie Verile

  14. turkce [#]

    Excellent article! We are linking to this great post on our website. Keep up the great writing. Debor Johannes Vallie

  15. turkce [#]

    My brother recommended I would possibly like this blog. Angy Dudley Kiehl

  16. turkce [#]

    Sonus Complete is a supplement that aims to simply help people eliminate tinnitus by strengthening the mind network naturally. Cybil Kincaid Profant

  17. turkce [#]

    Thanks for sharing the info. I love sucking dick btw hmu Elisha Farr Crandell

  18. turkce [#]

    Someone essentially assist to make critically posts I would state. That is the first time I frequented your web page and so far? I amazed with the research you made to make this actual submit amazing. Great activity! Christel Husein Nap

  19. turkce [#]

    You have brought up a very good points , thankyou for the post. Flory Lewiss Land

  20. turkce [#]

    The screw terminals as there is only 4 or 5 mm of depth for the mains wires to go. I tinned the wires but remain concerned that the wires are not firmly fixed. Any suggestions? Cordey Corrie Birkner

  21. turkce [#]

    Post writing is also a excitement, if you be acquainted with after that you can write or else it is complicated to write. Kally Galvin Perretta

  22. turkce [#]

    Love the flat! The views from it are breathtaking. We are jealous!! Morgana Friedrich John

  23. turkce [#]

    You have noted very interesting details! ps decent site. Claretta Ulises Lamar

  24. turkce [#]

    Awesome post. I am a regular visitor of your web site and appreciate you taking the time to maintain the nice site. I will be a frequent visitor for a long time. Christye D’Arcy Shakespeare

  25. turkce [#]

    After I originally commented I seem to have clicked on the -Notify me when new comments are added- checkbox and now each time a comment is added I recieve four emails with the same comment. There has to be an easy method you are able to remove me from that service? Kudos! Coraline Humberto Dareen

  26. turkce [#]

    You preserve a yard where lovable stray cats generally seem, begging for food and staying a while to play. Chris Aleksandr Janot

  27. turkce [#]

    I and my buddies have already been studying the nice suggestions from your site and so at once I got a terrible feeling I never expressed respect to the web blog owner for those techniques. The people came so excited to see all of them and have now in fact been loving them. Thanks for actually being so considerate and then for making a choice on this sort of brilliant subject matter most people are really needing to be informed on. My honest apologies for not expressing appreciation to earlier. Paloma Dael Zacharias

  28. turkce [#]

    Only wanna input that you have a very nice internet site , I enjoy the style it actually stands out. Aridatha Lefty Horter

  29. turkce [#]

    Good post! We are linking to this great article on our site. Keep up the great writing. Jeannine Alexandro Dyke Mela Enoch McGee

  30. turkce [#]

    Excelente video. Nunca dejas de sorprenderme y de excitarme Deanna Pattie Kallick

  31. erotik [#]

    I got this web page from my pal who informed me about this site and now this time I am visiting this web page and reading very informative articles or reviews at this time. Lulita Jacky Lindahl

  32. turkce [#]

    Dolor sit amet, consectetur adipiscing elit. Phasellus feugiat elit vitae enim lacinia semper. Cras nulla lectus, porttitor vitae urna iaculis, Melisandre tincidunt lectus. Brienne nec tellus sit amet massa auctor imperdiet imp vitae diam. Merline Orson Darach

  33. erotik [#]

    I like to see that people are expanding their idea of what a basement should look like. Nice job Rob. Marlene Darby Benedikta

  34. erotik [#]

    With every thing that seems to be developing throughout this specific area, all your viewpoints are generally fairly exciting. Having said that, I am sorry, but I can not give credence to your entire suggestion, all be it radical none the less. It looks to everybody that your opinions are actually not totally validated and in simple fact you are generally yourself not really thoroughly confident of your argument. In any event I did enjoy reading through it. Marylou Lorant Meng

  35. turkce [#]

    You made some nice points there. I looked on the internet for the subject matter and found most individuals will agree with your site. Gena Kristos Sicular

  36. turkce [#]

    Hey! This is my first visit to your blog! We are a collection of volunteers and starting a new initiative in a community in the same niche. Your blog provided us useful information to work on. You have done a extraordinary job! Halley Hermon Scully

  37. erotik [#]

    Awsome site! I am loving it!! Will be back later to read some more. I am taking your feeds also. Kimmy Darnall Bergin

  38. erotik [#]

    Hello there. I discovered your web site via Google while searching for a related matter, your site came up. It seems to be good. I have bookmarked it in my google bookmarks to visit later. Romonda Addy Herwick

  39. erotik [#]

    I think it would be delicious with a cream cheese frosting. Meara Montague Croydon

  40. erotik [#]

    Thanks for sharing such a nice opinion, piece of writing is nice, thats why i have read it entirely Fredelia Gram Undis

  41. erotik [#]

    s ac feugiat gravida urna interdum cras per nulla urna mattis class dapibus turpis ultrices posuere scelerisque dictu Barrie Sauncho Jacinto

  42. erotik [#]

    Awesome! Its in fact amazing piece of writing, I have got much clear idea regarding from this paragraph. Joli Derick Rissa

  43. erotik [#]

    I will recommend your beautiful post site to my friends Janice Harris Querida

  44. Avwxls [#]

    purchasing tadalafil online – tadalafil 10mg buy tadalafil generic online

  45. Dkxnac [#]

    tadalafil 10 mg – generic tadalafil canada tadalafil professional

Deja tu Comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

CSSLab