I am not a designer. When writing CSS, it often happens that I need to add some addition to an element. How to avoid this add-on for distribution to the parent element?
HTML:
<div id="outer"> <input id="login"> </div>
CSS
#outer { width: 300px; } #login { width: 100%; padding: 1em; }
If you use this HTML + CSS, you will see that the #outer element #outer larger than 300px . The simplest solution is to rewrite #login width to "300px - to_pixel(1em)" . It works well, but also means that the font size should now be fixed. Is there any other way when I don't need to convert everything to pixels?
source share