CSS: max-width for @media query not working

Have you tried adding the viewport in? <meta name=”viewport” content=”width=device-width, initial-scale=1″> Working JSFiddle Viewport is used when rendering responsive pages and is therefore mostly used when dealing with mobile websites, but when dealing with media queries it helps tell the CSS what the actual device-width is.

HTML-encoding lost when attribute read from input field

EDIT: This answer was posted a long ago, and the htmlDecode function introduced a XSS vulnerability. It has been modified changing the temporary element from a div to a textarea reducing the XSS chance. But nowadays, I would encourage you to use the DOMParser API as suggested in other anwswer. I use these functions: function …

Read more

Is there any benefit to adding accept-charset=”UTF-8″ to HTML forms, if the page is already in UTF-8?

If the page is already interpreted by the browser as being UTF-8, setting accept-charset=”utf-8″ does nothing. If you set the encoding of the page to UTF-8 in a <meta> and/or HTTP header, it will be interpreted as UTF-8, unless the user deliberately goes to the View->Encoding menu and selects a different encoding, overriding the one …

Read more

When working with text nodes should I use the “data”, “nodeValue”, “textContent” or “wholeText” field?

Of all these I’d choose data: it is defined for the nodes implementing CharacterData interface (Text and Comment ones) only. Trying to access this property for the others gives undefined. nodeValue is essentially the same as data for text nodes, but is actually defined for attribute and comment nodes as well. And I usually want …

Read more

HTML5 with jQuery – e.offsetX is undefined in Firefox

Try using layerX and layerY for Firefox and offsetX for other browser. If event fired with jquery: xpos = e.offsetX === undefined ? e.originalEvent.layerX : e.offsetX; ypos = e.offsetY === undefined ? e.originalEvent.layerY : e.offsetY; If event fired with javascript: xpos = e.offsetX==undefined?e.layerX:e.offsetX; ypos = e.offsetY==undefined?e.layerY:e.offsetY;

Flask css not updating [closed]

Problem is, as already said, related to browser cache. To solve that, you could add some dynamic variable to your static (css, js) links. I prefer last modified timestamp for each file. /static/css/style.css?q=1280549780 Here is a snippet for that: http://flask.pocoo.org/snippets/40/ @app.context_processor def override_url_for(): return dict(url_for=dated_url_for) def dated_url_for(endpoint, **values): if endpoint == ‘static’: filename = values.get(‘filename’, …

Read more