Skip to main content
Share Your Experience: Take the 2024 Developer Survey
87 votes
Accepted

Should you always program server side for a website?

If you don't know whether you need server-side code, you probably don’t* *Caveat: Server-side code is essential for security, when you want to internally control access to content, data, or ...
Tim Grant's user avatar
  • 1,360
56 votes

Should you always program server side for a website?

Read about static site generators. These allow you to create a site in a programmatic manner (using templates, data, etc), and not by hand-crafting HTML. The result is a set of static HTML and CSS ...
9000's user avatar
  • 24.3k
48 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 ...
JacquesB's user avatar
  • 59.7k
37 votes
Accepted

How can I prevent a user from editing my code in their browser?

You literally cannot prevent users from accessing and modifying content that you are sending them. You have no control over the browser, or which browser they use, or whether they are in fact ...
amon's user avatar
  • 134k
23 votes

How can I prevent a user from editing my code in their browser?

You can't. One of the fundamental rules of computing: you can't trust the client. Whatever clever scheme you think of, I can get round it if I am in control of the client.
Philip Kendall's user avatar
22 votes

Pros and Cons of Facebook's React vs. Web Components (Polymer)

The React guys have a pretty good explanation on the comparison between React and Web Components: Trying to compare and contrast React with WebComponents inevitably results in specious conclusions, ...
Erik Kaplun's user avatar
19 votes
Accepted

Why is the ampersand (&) a HTML Entity?

To avoid ambiguity. Suppose you want to write a website about HTML. You write the line: "To write a literal < you have to write &lt;." Now, to write that down in HTML: <p>To write a ...
Jasmijn's user avatar
  • 1,849
14 votes

Why does HTML collapse whitespace?

In HTML, line breaks are inserted at rendering time in order to make the line length fit the width of the screen. This is in contrast to both plain text formats and layout formats like PDF where line ...
JacquesB's user avatar
  • 59.7k
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,...
alexanderbird's user avatar
13 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> <...
Dan Pichelman's user avatar
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 ...
Adam Zuckerman's user avatar
10 votes

Pros and Cons of Facebook's React vs. Web Components (Polymer)

I think the biggest drawback of React in my opinion is that it isn't based on web standards. React is a very powerful tool right now, but because it circumvents so much of what the browser provides ...
Dogs's user avatar
  • 1,176
10 votes

Is it possible to prevent tech scammers from editing bank webpages?

There are some golden rules in Information Security that say that: If an attacker has physical access to your device, it's no longer your device. If an attacker has administrative access to your ...
Jörg W Mittag's user avatar
9 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 ...
Sz.'s user avatar
  • 191
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 ...
Mason Wheeler's user avatar
9 votes
Accepted

Are tables inside tables a good idea in the right circumstance

Semantic HTML is about accurately describing the semantic structure of your document. If your document contains tabular data, then use a table. If your document contains tabular data which is itself ...
Jörg W Mittag's user avatar
9 votes

Why is the ampersand (&) a HTML Entity?

It looks like this goes all the way back to SCRIPT which was invented in 1968. roughly speaking, SCRIPT became SCRIPT/VS which became GML which became SGMLguid which became HTML Here is the origonal ...
Ewan's user avatar
  • 76.4k
9 votes

How do you 'merge' several JS files into one?

I will answer this from the standpoint of code organization and architecture, rather than which tools to use. Typically multi-page sites have common library and framework code. This code is used on ...
Greg Burghardt's user avatar
8 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 ...
Tulains Córdova's user avatar
8 votes

How to do BDD for CRUD?

I built a mini CRUD application and I would like for someone to complete it by adding the tests If you are doing BDD you should have defined the required behaviour first. then written the tests, ...
Ewan's user avatar
  • 76.4k
8 votes
Accepted

Is it bad practice to leave hidden elements in the dom?

You seem to be primarily concerned with the performance difference between hiding a DOM component and removing it. The usual advice about performance applies: don't worry about performance unless you ...
Andrew's user avatar
  • 691
7 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 ("-"), ...
Rob's user avatar
  • 286
7 votes

How to do BDD for CRUD?

Requirements Typically you will define the behavior before you write the code. These start out as somewhat vague high-level requirements: unregistered users should be able to register registered ...
Bryan Oakley's user avatar
  • 25.3k
6 votes

Should you always program server side for a website?

You can and should use only a static site if it is enough, or use a static site generator. Why? Maintainability. Code has bugs. Every few weeks there is another WordPress security hole found. If you ...
Josef's user avatar
  • 297
6 votes

How to do BDD for CRUD?

I believe you have two separate questions here. One is: how can BDD be applied to a CRUD app, and the second is: how can I use BDD to build a simple registration app. BDD does not lend itself to ...
Jon Acker's user avatar
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 ...
GrandmasterB's user avatar
  • 39.2k
6 votes
Accepted

Is it good practice to wrap a single element in a container?

Correct, these particular divs are not strictly necessary. I created a JSFiddle example that deletes these divs from the example, and the layout still works (after setting the correct box model): ...
amon's user avatar
  • 134k
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 ...
Greg Burghardt's user avatar

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