Hot answers tagged

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.2k
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
  • 57.8k
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

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

Polymer is awesome. React is awesome. They are not the same thing. Polymer is a library for building backwards compatible web components. React is the V in MVC. It's the View, and nothing else. Not ...
Robotsushi's user avatar
  • 1,097
18 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,591
14 votes
Accepted

Is there a standardized practice for ordering attributes in HTML tags?

There is no standard. Optimize for ease of understanding, and try to be consistent. Personally I think it's also good to always put the id attribute first, so that it's easier for testers to find it.
Bryan Oakley's user avatar
  • 25.3k
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
  • 57.8k
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
12 votes
Accepted

Is there anything wrong with putting comments in an HTML closing tag?

This scenario is not covered in the spec: http://www.w3.org/html/wg/drafts/html/master/syntax.html#end-tags Moreover, the next section in the spec (Attributes) claims that attributes must be in start ...
async's user avatar
  • 854
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

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

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
  • 72.4k
9 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
  • 72.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
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
  • 681
7 votes
Accepted

Would it be possible to transfer an HTML file using a protocol different from HTTP?

Yes. You can transmit HTML over any medium that can transmit text. Email, for example. I'm willing to bet that at least 90% of all emails you receive, and probably also most that you write, are HTML. ...
Jörg W Mittag's user avatar
7 votes

Is there anything wrong with putting comments in an HTML closing tag?

Along with the section of the HTML Standard that defines the syntax for a valid end tag, as cited in another answer to this question, the HTML Standard also defines the presence of attributes in end ...
sideshowbarker's user avatar
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

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