HTML: Valid id attribute values?

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 and …

Read more

Get meta tag content property with BeautifulSoup and Python

Provide the meta tag name as the first argument to find(). Then, use keyword arguments to check the specific attributes: title = soup.find(“meta”, property=”og:title”) url = soup.find(“meta”, property=”og:url”) print(title[“content”] if title else “No meta title given”) print(url[“content”] if url else “No meta url given”) The if/else checks here would be optional if you know that …

Read more

Why does IE9 opens in Document Mode as IE7 standards?

Try this answer: Summary, give the IE browser more information in the meta tag: <!DOCTYPE html> <html> <head> <title>My Web</title> <meta http-equiv=”X-UA-Compatible” content=”IE=edge” /> Edit Note: As Olly Hodgson mentioned, the proper option is IE=edge, as currently stated in the above snippet. Below is the original, also working version: <meta http-equiv=”X-UA-Compatible” content=”IE=100″ />

How do I center an anchor element in CSS?

Add the text-align CSS property to its parent style attribute Eg: <div style=”text-align:center”> <a href=””>example</a>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ </div>​ Or using a class (recommended) <div class=”my-class”> <a href=””>example</a>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ </div>​ .my-class { text-align: center; } See below working example: .my-class { text-align: center; background:green; width:400px; padding:15px; } .my-class a{text-decoration:none; color:#fff;} <!–EXAMPLE-ONE–> <div style=”text-align:center; border:solid 1px #000; padding:15px;”> <a href=””>example</a>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ …

Read more