How can I retrieve the page title of a webpage using Python? How can I retrieve the page title of a webpage (title html tag) using Python? Solution: I'll always use lxml for such tasks. You could use beautifulsoup as well. import lxml.html t = lxml.html.parse(url) print t.find(".//title").text
undefined
How can I find unused images and CSS styles in a website? Is there a tool or methodology (other than trial and error) I can use to find unused image files? How about CSS declarations for ID's and Classes that don't even exist in the site? It seems like there might be a way to just spider the site, profile it, and see which images and styles are never loaded. Solution: There's a Firefox extension that finds unused CSS selectors on a page.
undefined
How to align checkboxes and their labels consistently cross-browsers This is one of the minor CSS problems that plagues me constantly. How do folks around StackOverflow vertically align checkboxes and their labels consistently cross-browser? Whenever I align them correctly in Safari (usually using vertical-align: baseline on the input), they're completely off in Firefox and IE. Fix it in Firefox, and Safari and IE are inevitably messed up. I waste time on this every time I code a form. Here's the standard code that I work
undefined
How to disable resizable property of textarea? I want to disable the resizable property of a textarea. Currently, I can resize a textarea by clicking on the bottom right corner of the textarea and dragging the mouse. How can I disable this? Answer: The following CSS rule disables resizing behavior for textarea elements: textarea { resize: none; } To disable it for some (but not all) textareas, there are a couple of options. To disable a specific textarea with the name attribute set to foo (i.e., <textarea name="foo"></textarea>): textarea[name=foo] { resize: none; } Or, using an id attribute (i.e., <textarea id="foo"></textarea>): #foo
undefined
How do I make a placeholder for a 'select' box? I'm using placeholders for text inputs which is working out just fine. But I'd like to use a placeholder for my selectboxes as well. Ofcourse I can just use this code: <select> <option value="">Select your option</option> <option value="hurr">Durr</option> </select> But the 'Select your option' is in black instead of lightgrey. So my solution could possibly be CSS-based. jQuery is fine too. This only makes the option grey in the dropdown (so after clicking
undefined
What are valid values for the id attribute in HTML? When creating the id attributes for HTML elements, what rules are there for the value? Answer: For HTML 4, the answer is technically: 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 ("-"), underscores ("_"), colons (":"), and periods ("."). HTML 5 is even more permissive, saying only that an id must contain at least one character
undefined
Is there a W3C valid way to disable autocomplete in a HTML form? When using the xhtml1-transitional.dtd doctype, collecting a credit card number with the following HTML <input type="text" id="cardNumber" name="cardNumber" autocomplete='off'/> will flag a warning on the W3C validator: there is no attribute "autocomplete". Is there a W3C / standards way to disable browser auto-complete on sensitive fields in a form? Answer: Here is a good article from the MDC which explains the problems (and solutions) to form autocompletion. Microsoft