There are <meta>
tags and other things you can place in the <head>
of your HTML document. What <meta>
tags etc. and best practices do you make use of in your HTML document to make it more accessible, searchable, optimized etc.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
You'll want to put SCRIPT elements at the end of the page before the close of the BODY element. See http://developer.yahoo.com/performance/rules.html#js_bottom for details.
Besides the usual doctype, title, etc, I will try and provide you with some things I have learned and implemented that might be of assistance to you.
Firstly, remember that the title, for best user experience should have the most relevant sub section first. This is because it is usually displayed in the title bar/tab list/bookmark name. Consider this page title...
becomes Stack Overflow... (munched to save room in tab bar/bookmark list)
Now if you had 5 Stackoverflow tabs open (as I often do :P) then how would the user know which one is which?
Also note with CSS the cascading nature... So the order of these will matter. Same with Javascript, any dependencies on other external sites must be allowed for. I put mine in the head and havn't noticed a performance decrease. I put them there because it to me looks more tidy and logical. Though some other people will recommend putting the
<script src="">
links in just before</body>
so the browser won't temporarily stall... Just use whatever works best for your site.Also a Meta tag of 'rating' with 'general' let's Net Filtering software know your site is safe for viewers of all ages (as long as it is, of course!)
I also use..
to let the browser know where the home of my site is. And for any browser prefetching systems, though I believe these are yet to be implemented by browsers without assistance of plugins.
Also consider the 'next' and 'prev'
<link rel="">
if your pages are in a sequence of sorts.There is a related question here that may help add some light regarding the order of the tags.
Generally my pages include the following:
DocType is important to enforce strict rendering (No quirks mode) by the browser. You may want to use XHTML instead - as long as there is one there. I add Copyright and Author purely because I design and create the pages for other companies. Description is for SEO, and Language is for the browser (if it supports it).
I don't believe it makes to much of a difference which meta tag comes first, or whether the title should be above. What counts in most cases is that it exists on the page, and has the correct content.
Title, meta tags for keywords, content-type (if not explicitly set by the web server), and any CSS to be applied to the page.
Declaring the CSS up front allows the browser to lay out the page more efficiently (see http://developer.yahoo.com/performance/rules.html#css_top).
I would add an important note: if you're using IE's
meta X-UA-Compatible
tag to switch rendering modes for Interet Explorer, you must insert it as the first item in HEAD:I didn't see this mentioned: the
<base>
tag, if specified, should be the first element in<head>
. (The base URI of the document is assumed to be.
before/if not specified.)