Simon Willison’s Weblog

Items tagged html, quora

Filters: html × quora ×

Why can’t I do style=“padding: 20px” and a border in the same div?

You can’t have two style attributes on the same element—but you can have two styles rules inside the same attribute. Try this instead:

[... 48 words]

Should I store markdown instead of HTML into database fields?

You should store the exact format that was entered by the user.

[... 95 words]

What are the different ways in which web sites can be developed?

There are a few languages that provide an alternative syntax that compiles to HTML (Haml is quite a popular one) but generally you need to have a very good understanding of HTML in order to do any web development at all, no matter what server-side technology you use. Likewise for CSS—Sass and LESS provide alternative syntax that compiles to CSS, but they are no replacement for understanding how CSS actually works.

[... 94 words]

What data structures are used to implement the DOM tree?

You may enjoy this post from Hixie back in 2002 which illustrates how different browsers deal with incorrectly nested HTML. IE6 used to create a tree that wasn’t actually a tree!

[... 49 words]

What’s the best way to handle logins?

First, make sure you’re storing the password as a salted hash, using a deliberately slow hashing algorithm such as bcrypt, scrypt or PBKDF2—here are some recent articles to get you up to speed:

[... 176 words]

What is the difference between XHTML 1.0 strict and transitional?

Not a lot. XHTML transitional lets you use a few presentational attributes and elements that aren’t available in XHTML strict. Here’s a more detailed overview from back in 2005:

[... 59 words]

Could browsers be made to scroll down (e.g. by 67%) if you add #67% to a URL?

I’d say no.

[... 89 words]

Is there any consensus yet on link rel=shorturl vs rev=canonical?

It’s pretty clear from the answers that rev=canonical v.s. rel=canonical is way too confusing—so it’s down to rel=shortlink v.s. rel=shorturl.

[... 38 words]