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 ...
user avatar
  • 54.8k
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 ...
user avatar
10 votes
Accepted

Is loading the same .jpg in different qualities a waste of data?

No, neither the server, nor the client know that it is the same image. The images are unrelated to each other as far as anyone can tell. That's the factual reality. What you need is progressive ...
user avatar
  • 31.4k
9 votes
Accepted

Should I use <table> or <div>?

Tables are appropriate for creating actual tables (AKA grids) as part of your HTML. A timesheet would be a good example of a grid. The "don't use tables; use divs" meme is about how it used to be ...
user avatar
7 votes
Accepted

How to handle time based events in web application backend?

You can do this a few different ways. What you ultimately do depends on your server-side stack, your permissions on the server, and the nature of the side-effects needed for the delayed event. As I ...
user avatar
  • 13.2k
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-...
user avatar
  • 8,450
2 votes

PSD to HTML/CSS limitations when using Twitter Bootstrap

From what you've said, I've understood: "if we use this tool, we'll be forced to follow its design choices. If we do not use it, we'll need to spend much more time creating our own design choices". ...
user avatar
  • 319
2 votes

PSD to HTML/CSS limitations when using Twitter Bootstrap

You are not forced to use everything from the twitter bootstrap bundle. It is an option, not a rule. If you want your own elements, such as buttons, but like some bootstrap elements (the grid system ...
user avatar
  • 9,915
2 votes

How to handle time based events in web application backend?

You have to store your tasks, for instance in a db table, with at least the following informations: time_to_execute: timestamp of when task was set + delay in seconds to_do: things to do (this must ...
user avatar
  • 315
1 vote

How do big publishers edit their websites?

You need to better understand what happens when source code changes. Let's imagine that the website has a hardcoded logotype. Recently, the marketing decided to change the logotype, and the new one ...
user avatar
1 vote

Allowing a user on one page to be able to cause an event on another

You need to use simple ajax function that would keep pooling from a server for new alerts. websocket is good alternative here, but you can do that with normal ajax http calls. When the form is ...
user avatar
1 vote

How to handle time based events in web application backend?

A simple approach is to have a pending tasks table in your database. To create a task, add a row to the table that contains the action time, and any other data needed to process the task. You have a ...
user avatar
  • 1,663

Only top scored, non community-wiki answers of a minimum length are eligible