Phrase with different HTML5 formatting

Asked

Viewed 336 times

1

What is the best way to write a phrase code that contains several font formats.

EX:

This phrase (bold and blue color) that I am writing of example (Italian not bold and red color) contains in parentheses the formatting of each word, however as it would be a good code written using html and css. (the rest of the text I want font 50 and white color)

Detail I know that if I keep opening tag by tag would work, however in html this text would not be in the same line as if it were part of a paragraph only. Related to good practices how you could write code for this example?

I can use the span tag for this?

  • What did you mean by "that text would not be on the same line in HTML"?

  • When I open a <p> it creates another paragraph and goes to the bottom line

  • Ah, that’s right. But if you use elements that have the display: inline that will not happen, such as the span, who quoted.

1 answer

2


Always use the tag <p> paragraphs and whenever changing the formatting in the middle of the paragraph use the tag <span>. Try to avoid inline css, type <span style="color: #d9d9db; font-weight: bold; font-style: normal;"> use classes (try to give consistent names) css to do this, because it reduces the size of your html pages and the css is in the browser’s cache. the code with css inline would look <span class="cinza-negrito">

Another tip I suggest is to use some css framework like the bootstrap for your initial formatting.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.