15
votes
Accepted
Performance consideration for cascading style sheet implementation
Unfortunately there is no way to tell what performance will be like. There are too many variables to make a prediction. Worse yet, if you haven't been given hard performance metrics then you have no ...
11
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 ...
8
votes
Accepted
Is there a rule of thumb when it comes to the "name" attribute?
Name is a CDATA type so the following applies:
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), ...
6
votes
Accepted
How to white label my website in php
Its been a few years now, but the last PHP system I developed did something like that. We offered custom domain names, rather than directories, but the principal is the same.
It was a template ...
6
votes
What are CSS modules? Are they a library, or a spec, or what?
CSS modules rely on the native CSS and JavaScript processing capability of web browsers. Therefore you need not install anything new; a web site might use them and you could never notice.
As the ...
6
votes
Why don't web browsers know the physical dimensions of a display?
In general, a computer has no idea of the physical size of the monitor you have plugged in to it. That may be different for smartphones or tablets, of course. But some tablets have HDMI outputs.
It's ...
6
votes
Accepted
Could there be a <flex> tag?
This question is wildly in need of focus, but most of the questions have an easy answer.
Who is in charge of this? The W3C.
Is there a place to submit proposals? Yes. See the link above.
The first ...
5
votes
Is CSS inspired from C?
Yes.
If you check the original proposal: https://www.w3.org/People/howcome/p/cascade.html you can see the following quote
The C-style syntax of the first statement reads: If the document is
older ...
5
votes
Accepted
Advantages and disadvantages of including JS/CSS inside the HTML?
The reason why js and css will be seperated is for bundling and minification purposes.
When you write them inside a HTML file, then the file size increases and takes time to load, which will degrade ...
4
votes
Accepted
Is JavaScript added and executed in parsing or in rendering?
It's a bit more complicated, as JavaScript execution is interleaved with the normal lifecycle of the page.
First, the browser must parse the HTML code into the Document Object Model. When the parser ...
3
votes
What are CSS modules? Are they a library, or a spec, or what?
Its a js based workaround for the lack of scope in CSS.
The bundler/framework assigns auto-generated unique classes to your css scripts and then dynamically inserts them into the appropiate place in ...
3
votes
Accepted
What are the points of apps like Sketch and Photoshop when it comes to Web Development?
Web design consists of two aspects: designing a site, and implementing it. You are used doing both together, but it can often be sensible to separate them. For example, you might use a wireframe to ...
3
votes
Accepted
Using CSS classes to express state
Using classes to track state is pretty common, for example - in AngularJS: https://docs.angularjs.org/api/ng/directive/form#css-classes
but - remember that css-classes are easily manipulated in the ...
3
votes
Add extra HTML classes for frontend-tests?
This is actually an important question, because I see lots of people using class values for semantic information and having various problems.
The important thing to realise is that a class is a ...
3
votes
Why does :nth-child() in CSS start from 1 instead of 0?
Probably for consistency with XPath, another XML / HTML processing language. Which begs the question, why does XPath use 1 based indexing?
See https://stackoverflow.com/questions/3319341/why-do-...
3
votes
Accepted
Inline HTML elements don't allow setting "width" - why is that?
I don't have a definitive answer, but I believe that the concept of "width" is too hard to rigorously define within HTML/CSS for inline elements.
Block level elements are defined such that their ...
3
votes
Accepted
What are some of the best ways to create single page websites with dynamic content?
The thing you are looking for is called AJAX.
It consists of an ability for a web page to perform an HTTP request without refreshing itself, and based on the response of this request, to update a ...
3
votes
Accepted
What are downsides to opening local html files in the browser?
this can become problematic if your JS needs to make any REST requests. The CORS policies will simply reject you. You will not be able to perform any OAuth either. If you want to use any decent js ...
3
votes
Semantic Versioning for CSS
For me the definition of Major, Minor, Patch does not change when i apply it to different libraries / frameworks.
As a "user" of a library / framework, a "major" change is one, ...
3
votes
Is the BEM methodology in the large project used correctly
Not everything needs a class. Furthermore, words like "item" are not a modifier. They are another element. A modifier would indicate some change in state, such as "deleted" or &...
2
votes
Why Have People Started Deeming it Necessary to Separate JS hooks from CSS hooks in HTML?
As someone who’s adopted this pattern, one of the biggest reasons I’ve done it is that I feel it makes the markup a little more semantic. If I’m working on changes that touch an element with a .js- ...
2
votes
Should I write HTML or CSS first?
Even though this is a very old Q&A, I feel the need and responsibility to comment on it.
Yes, HTML should be written before CSS, however...
You do NOT write all HTML on the page, and then go ...
2
votes
When should I use a CSS class over inline styling?
I like inline-styles while designing in-browser since I don't have to go back and remove selectors that I don't end up using. It's also quicker for me to see what styles are applied to what and from ...
2
votes
If either html+css or an image can achieve my desired decoration, which one should I prefer to use?
Neither approach is correct, because you first need to use Semantic HTML. As such, if you have "step 1" followed by "step 2" you really have an ordered list. Start with that and style it however you ...
2
votes
Is there a rule of thumb when it comes to the "name" attribute?
There is no such naming convention in HTML for name attribute as well as for other attributes also. But you should follow the following rules.
Use lowercase Latin letters.
Separate different words by ...
2
votes
Do I need to put a license in my website's HTML and/or CSS?
You can add whatever license you want to your CSS files. Here's an example.
One way to receive credit and attributions is putting "Designed by xxx" in the footer of the site (make sure the team or ...
2
votes
Accepted
Repeating CSS class contents. Structuring css code
The reason this:
Example 1
.box1, .box2, .box3, .box4 {
/* common styles */
}
.box1 {
border-color: red;
}
.box3 {
text-align: center;
}
is preferable to this:
Example 2
.box1, .box2,...
2
votes
Hierachy and API design for a CSS-selector-related Python library
Because Python has very different syntax and semantics from CSS selectors, I think these problems will only get worse. You'll end up with something that doesn't look like CSS does and something that ...
1
vote
Best practices for positioning elements in an HTML-based game
It'd be nice if this used some kind of grid-based system so that it
would automatically scale to arbitrary window sizes without the
program manually calculating pixel widths and so forth.
Tetris ...
1
vote
Abstracting a CSS framework in an enterprise web application
While CSS lets you decouple your HTML structure and its appearance to some degree, you will never be able completely decouple them. A dependency on something like Bootstrap is not something you can ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
css × 280html × 127
javascript × 76
web-development × 47
html5 × 17
design × 14
jquery × 14
css3 × 12
php × 11
web-applications × 11
coding-style × 10
web × 10
bootstrap × 10
front-end × 9
websites × 7
web-design × 7
responsive-design × 7
programming-practices × 6
asp.net × 6
coding-standards × 6
xml × 5
server-side × 5
c# × 4
architecture × 4
performance × 4