-4

Is it possible to add a span to an < a > element? If so what is the appropriate syntax? These are the two I have tried but neither is working with my CSS.

<a span="add_button">+Add a Review</a></span>

<span="add_button"><a>+Add a Review</a></span>
L-Mo
  • 27
  • 1
  • 5
  • 2
    1) `span` is an invalid custom attribute which won't let you validate your document. 2) `` span is not an attribute, Element tag in not defined or invalid character `=` with no attribute detected :) In Both cases what you're doing is invalid and I need to suggest you to review some HTML basics. – Roko C. Buljan Jul 27 '14 at 04:04

2 Answers2

1

It should be <a href="something"><span>Something</span></a>

MikeWu
  • 3,042
  • 2
  • 19
  • 27
0

Both <a> and <span> are HTML elements. So, neither of the two you tried is an appropriate syntax.

It seems that you are trying to put a <span> inside an <a>, or an <a> inside a <span> (both of which are perfectly alright, btw), which would be done as follows:

<span id="add_button">
    <a href="some/path">+Add a review</a>
</span>

Then, your CSS would look something like:

span#add_button {
    /* Rules for the <span> */
}

span#add_button > a {
    /* Rules for the <a> inside the <span> */
}
Community
  • 1
  • 1
John Bupit
  • 10,406
  • 8
  • 39
  • 75