kommentar i en css-fil?

HTML & CSS

5 svar · 414 visningar · startad av trensare

Medlem sedan feb. 200129 inlägg
Trådstart#1

Hur skrivar man... eller går det överhuvudtaget. Kör med vanliga html-kommentarer o det verkar funka, men kan det bli problem?

Medlem sedan maj 200010 687 inlägg
#2

Jag tror det kan bli problem. Och har man en inkluderad CSS-fil så funkar det inte. Då är det bättre med:

/* Detta är en kommentar */
Medlem sedan feb. 200129 inlägg
#3

Japp. Det är en includerad css

Medlem sedan feb. 200129 inlägg
#4

Alltså...

<STYLE TYPE="TEXT/CSS">
<!--
A:link { text-decoration: none; color: #666666 }
A:visited { text-decoration: none; color: #666666 }
A:active { text-decoration: none; underline: #000000 }
A:hover { text-decoration: none; color: #000000 }
A.type1:link { color:#FFFFFF; text-decoration:none; }
A.type1:visited { color:#FFFFFF; text-decoration:none; }
A.type1:active { color:#FFFFFF; text-decoration:none; }
A.type1:hover { color:#FFFFFF; text-decoration:overline underline; }
-->
</STYLE>

/* kommentaren här */

Medlem sedan juni 20004 308 inlägg
#5

CSS-filen skall inte innehålla några element (taggar)

filnamn.css

A:link { text-decoration: none; color: #666666 }
A:visited { text-decoration: none; color: #666666 }
A:active { text-decoration: none; underline: #000000 }
A:hover { text-decoration: none; color: #000000 }
A.type1:link { color:#FFFFFF; text-decoration:none; }
A.type1:visited { color:#FFFFFF; text-decoration:none; }
A.type1:active { color:#FFFFFF; text-decoration:none; }
A.type1:hover { color:#FFFFFF; text-decoration:overline underline; }
/* och en liten kommentar */

Däremot tillåter standarden html-kommentarer: <!-- ... --> för att gömma CSS-koden i gamla webbläsare, men de fyller ingen funktion som kommentarsavgränsare.

Medlem sedan feb. 200129 inlägg
#6

ok. Tack för hjälpen!

275 ms totalt · 4 externa anrop · v20260731065814-full.d34c6d5a
137 ms — deklarationer (db)
0 ms — hämta statistik (cache)
133 ms — hämta tråd, inlägg och bilagor (db)
127 ms — ändringar (db)