162
votes
Why are people making tables with divs?
The question is if the data is semantically a table (i.e. a set of data or units of information logically organized in two dimensions) or you just use the grid for visual layout, e.g. because you want ...
134
votes
Accepted
Why are people making tables with divs?
This is a common pattern for making responsive tables. Tabular data is tricky to display on mobiles since the page will either be zoomed in to read text, meaning tables go off the side of the page and ...
118
votes
Accepted
Why are large amounts of magic numbers acceptable in CSS and SVGs?
Firstly, magic values are avoided in programming by using variables or constants. CSS does not support variables, so even if magic values were frowned on, you don't have much of a choice (except using ...
104
votes
Why are people making tables with divs?
Actually, I would say that the use of class names like "table" in your example demonstrates how people don't actually understand what they're doing when trying for semantic markup. They get marks for ...
80
votes
Why are large amounts of magic numbers acceptable in CSS and SVGs?
It's acceptable because these formats are not code, but data. If you were to remove all the "magic numbers," you would essentially duplicate every label, and end up with ridiculous looking files like:...
45
votes
Why does :nth-child() in CSS start from 1 instead of 0?
CSS uses ordinal numbering when identifying elements in an ordered collection. For example :first-child matches the first child element of a parent, @page :first matches the first page, ::first-line ...
35
votes
Accepted
What makes BEM better than using a nestable style sheet language like LESS?
A colleague of mine is heavily pushing the BEM (Block Element Modifier) method for the CSS in a project he's helming, and I just cannot comprehend what makes it better than the LESS CSS we've been ...
25
votes
Why are large amounts of magic numbers acceptable in CSS and SVGs?
The prohibition on magic numbers is the primordial version of this design principle:
Make decisions in one place.
But these are not magic numbers. At least, not as far as any coding style guide I ...
25
votes
Accepted
Are ems still relevant?
However, this effect will be negated if I define the font size in the body tag for example.
body {
font-size: 16px;
}
Because now my css is overriding the font size set by the browser.
You are ...
18
votes
Should minified CSS be stored in Git?
No.
Source control should only contain source.
If it's generated from source, it doesn't belong there - and should be generated by your build process.
The fundamental reason you don't want to source ...
18
votes
Accepted
Should minified CSS be stored in Git?
"It depends." For normal development tracking, no. For cloud and DevOps deployments, however, it's often convenient, or even required.
Most of the time,
@ptyx is correct. Indeed, his "no" could be ...
17
votes
Accepted
Why is it (or was it) important to separate CSS from HTML?
1. Why was it important to separate CSS from HTML?
Originally, JavaScript was used for fancy (and extremely annoying) animations and websites were globally just a bunch of HTML and CSS. On server side,...
17
votes
Accepted
Why does Facebook obfuscate the names of CSS classes?
It's called minification. It makes the CSS files (and potentially Javascript files too) smaller, requiring less bandwidth to download. This can make a significant difference in performance, ...
16
votes
Accepted
How to namespace your CSS?
There are no namespaces in CSS. All you do in CSS ends up in global scope. This is by design.
This leads to two problems:
What happens to the apps using my library if, in the library, I introduce a ...
13
votes
Why are people making tables with divs?
In the olden days, the table rendering engine "appeared" slower when you used percentages for column widths. The engine essentially had to download the entire data set before it would then begin ...
13
votes
Accepted
What is the reason that CSS variables are defined using two hyphen characters (--)?
When CSS Variables were introduced, there needed to be a syntax that does not clash with existing CSS versions, and allows future CSS versions to declare new properties. Properties that begin with a ...
13
votes
Accepted
Are there any reasons not to ever use classes or ids anymore?
This seems like a very bad idea to me. defining css rules for classes and adding those classes to the html is a great way to make your css reusable. The way you're suggesting, with a complex selectors,...
13
votes
Are ems still relevant?
the point of ems is to define all measurements in your webpage, by the base font size
This may be a misunderstanding of terms on my part, but to clarify: em is relative to "the current element's" ...
12
votes
Accepted
Why are there so many CSS properties which are essentially the same?
Most of these are due to vendor prefixes.
A new standard that has not been finalized may get implemented in a browser, but since it has not been finalized, the browser vendor (creator) will not want ...
12
votes
What makes BEM better than using a nestable style sheet language like LESS?
Edit 2017
If you're reading this in 2017, the shadow DOM and shadow DOM polyfills, plus components solve all of these problems, while keeping your code small, tight and modular. Don't use BEM on a ...
11
votes
Accepted
Why is it bad to use inline styling in HTML for generic styles?
Looking at your updated question,
Why is this
<div>
<textarea class="width90"></textarea>
</div>
.width90{
width:90%;
}
any better than this?
<div>
<...
11
votes
Accepted
Why doesn't CSS allow single-line comments?
Backwards compatibility
Introducing single-line comments to the CSS syntax could change the meaning of files which currently uses the token //. Browser vendors are very reluctant to introduce changes ...
10
votes
Why does :nth-child() in CSS start from 1 instead of 0?
From the CSS Level 3 Selector Specification:
6.6.5.2. :nth-child() pseudo-class
The :nth-child(an+b) pseudo-class notation represents an element that has an+b-1 siblings before it in the document ...
10
votes
Why are large amounts of magic numbers acceptable in CSS and SVGs?
Because CSS is not a programming language, instead, it is the configuration file that contains the variable data for your program.
Currently CSS is so powerful that you can actually program in it, ...
8
votes
Accepted
Why would HTML and CSS be required for .NET development?
HTML is a design and layout language, not a programming language. Is't almost always paired with JavaScript, which is a programming language.
.NET is a catchall name for a number of Microsoft ...
8
votes
Accepted
Should I be using OOCSS in a CSS theme?
I think that OOCSS by way of your example is an anti-pattern that does not provide a clear separation of concerns (html vs css) and does not provide you with semantic html nor css.
The separation of ...
8
votes
Why doesn't CSS allow single-line comments?
Supporting yet another syntax element isn't that easy: there are plenty of tools which should be able to handle yet additional comment style. Actually, I wouldn't be surprised to see that most ...
7
votes
Will it be a wrong idea to have <style> in <body>?
(Since we are here at SE.SX, a more strategic approach may be a valuable augmentation to the usual technical considerations.)
[preamble] The HTML5 spec is a continuously moving target, and they have ...
7
votes
Why is it bad to use inline styling in HTML for generic styles?
In layman's terms:
Because when you have a lot of pages with a lot of inline styling, and some user askes for cosmetics change, the you will have to make a lot of changes in a lot of places, and ...
7
votes
Why does Facebook obfuscate the names of CSS classes?
Another likely answer is that they use this to subvert adblockers.
These usually select elements for removal based on their css attributes, i.e.:
class="post promoted".
Obfuscating the css names makes ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
css × 275html × 124
javascript × 73
web-development × 46
html5 × 17
design × 14
jquery × 14
css3 × 12
php × 11
web-applications × 11
web × 11
coding-style × 10
bootstrap × 10
front-end × 8
websites × 7
responsive-design × 7
programming-practices × 6
asp.net × 6
coding-standards × 6
web-design × 6
xml × 5
server-side × 5
c# × 4
performance × 4
optimization × 4