Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are there slashes in this div id?

Tags:

html

css

I was browsing a site and found this line of code:

<div class="section slideshow" id="/featured/">

I've never seen slashes in an id tag before, is this poor coding, a problem written out by the database, or something else?

like image 701
GT22 Avatar asked Aug 02 '12 09:08

GT22


3 Answers

Slashes in an id attribute is not a valid character:

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 (".").

like image 92
Danny Brady Avatar answered Oct 04 '22 14:10

Danny Brady


Maybe to use it directly in an url and/or with javascript...

like image 20
Phebus40 Avatar answered Oct 04 '22 15:10

Phebus40


Maybe he use this method for insert to database(insert id in a string) or go to an url .

Slashe is not a valid character for ID in html 4.01 but its valid in html5 .

For html 4.01

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 (".").

Reference : What are valid values for the id attribute in HTML?

http://www.w3.org/TR/html5/global-attributes.html#the-id-attribute

like image 21
RAN Avatar answered Oct 04 '22 13:10

RAN