I am about to finish up my dynamic classifieds website (php) and have some problem with figuring out how to write the meta and title tags.
I have read mixed articles about the & sign, and how to use it in the title or meta tags properly.
What role does the document encoding have and does the DOCTYPE have anything to do with this also?
In my case, this is my document top:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
I wonder, should I write the and tags with an ‘&‘ or an ‘&‘ instead?
Just as an example:
<title>Dolce & Gabbana</title>
or
<title>Dolce & Gabbana</title>
I can’t use the word ‘and’ simply because it doesn’t “look” as good.
Thanks
In this case both
&and even just&are valid as the latter is followed by a whitespace and thus cannot be confused with a reference open delimiter.But the HTML 4 specification recommends to use
&to avoid ambiguity:See my answer on Do I really need to encode ‘
&‘ as ‘&‘? for further information.