Fit background image to div

You can achieve this with the background-size property, which is now supported by most browsers. To scale the background image to fit inside the div: background-size: contain; To scale the background image to cover the whole div: background-size: cover; JSFiddle example There also exists a filter for IE 5.5+ support, as well as vendor prefixes … Read more

What is aria-label and how should I use it?

It’s an attribute designed to help assistive technology (e.g. screen readers) attach a label to an otherwise anonymous HTML element. So there’s the <label> element: <label for=”fmUserName”>Your name</label> <input id=”fmUserName”> The <label> explicitly tells the user to type their name into the input box where id=”fmUserName”. aria-label does much the same thing, but it’s for … Read more

What’s the proper value for a checked attribute of an HTML checkbox?

Strictly speaking, you should put something that makes sense – according to the spec here, the most correct version is: <input name=name id=id type=checkbox checked=checked> For HTML, you can also use the empty attribute syntax, checked=””, or even simply checked (for stricter XHTML, this is not supported). Effectively, however, most browsers will support just about … Read more

Is it valid to replace http:// with // in a ?

A relative URL without a scheme (http: or https:) is valid, per RFC 3986: “Uniform Resource Identifier (URI): Generic Syntax”, Section 4.2. If a client chokes on it, then it’s the client’s fault because they’re not complying with the URI syntax specified in the RFC. Your example is valid and should work. I’ve used that … Read more

How to make a HTML Page in A4 paper size page(s)?

Ages ago, in November 2005, AlistApart.com published an article on how they published a book using nothing but HTML and CSS. See: http://alistapart.com/article/boom Here’s an excerpt of that article: CSS2 has a notion of paged media (think sheets of paper), as opposed to continuous media (think scrollbars). Style sheets can set the size of pages … Read more

Is there a tag to turn off caching in all browsers? [duplicate]

For modern web browsers (After IE9) See the Duplicate listed at the top of the page for correct information! See answer here: How to control web page caching, across all browsers? For IE9 and before Do not blindly copy paste this! The list is just examples of different techniques, it’s not for direct insertion. If … Read more