Is it wise / good practice to give the SPAN tag different classes within a DIV. For example styling paragraphs of text that need a specific layout / position colour etc… ?
Or are there better / more efficient ways?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You would have less HTML if you gave the paragraph itself the class, rather than wrapping the contents of a paragraph with a
span, but it’s perfectly possible to do what you’ve said. You can of course give multiple paragraphs the same class:HTML:
Or give the
diva class and select the paragraphs using that.HTML:
CSS:
Or each one a different class giving you plenty of flexibility
HTML:
If you need to just highlight different bits of a single paragraph, then a
spanis acceptable, but don’t forget to consider ready made tags likestrongorem.