Por favor, necesita agregar una clase especial

Im trying to add a third class before the "last" but how? I always get syntex errors if I add it like this:

<li class="THIRD CLASS" class="last"><a href="contact.php"class="transition">Contact Us</a></li>

Por favor, ayúdame,

Sinceramente.

preguntado el 28 de julio de 12 a las 22:07

Solo usa uno class attribute instead of two? -

Class names can't have a space in them. -

just a example. Its not the actual name. How exactly do I add a third class there? For a few reasons i must have 3 classes because of some scripting and other reasons -

5 Respuestas

Never use whitespace in an identifier (let it be in CSS or Java or whatever). So THIRD_CLASS.

In order to use two styles together, put them in the same class attribute separated by whitespace

 <myTag class="my_style my_other_style"/>

Respondido 28 Jul 12, 22:07

Tu puedes hacer:

<li class="last anotherclass"><a href="contact.php"class="transition">Contact Us</a></li>

They will be applied in the order they are declared.

Respondido 28 Jul 12, 22:07

Wow, thank you very much! this very much solved my problem :) In 5 minutes I will check the answer as solved - Demorus

No problem, techanilties suck and compilers and run-time errors can be less than helpful sometimes. - Empuñaduras Vaughan

This isn't correct. You should be using

<li class="THIRD_CLASS last"><a href="contact.php"class="transitio...

Hay dos diferencias:

  1. I only use one class attributes separating the names by spaces
  2. I renamed "THIRD CLASS" to "THIRD_CLASS" as class names shouldn't have spaces in them.

Respondido 28 Jul 12, 22:07

You can only have one class attribute per tag, and class names must be one word, eg

Respondido 28 Jul 12, 22:07

Solo haz esto:

<li class="THIRD_CLASS last"><a href="contact.php"class="transition">Contact Us</a></li>

Respondido 28 Jul 12, 22:07

you cannot have spaces in a single class if you look at the question third class is actually one class not two - Kishore

Just guessing, but probably because you can't have a space in a class name. - pablo tomblin

Why not edit my answer to add an _ or tell me in the comments, as this was just a spelling mistake? - Fredrik Sundmyhr

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.