Free tech support / small logo


How do I change text formatting in HTML?

This is a really basic question, but I'm still just trying to figure all this Internet stuff out. I don't know any HTML. I would like to know how to a) place HTML in my coding to turn a paragraph color to red and b) increase the font size.


Dave's Answer:

Nothing wrong with being at the beginning of the journey of learning about HTML and the Web. You're definitely not alone and, frankly, there are precious few people who aren't somewhere on that road too, even if sometimes it seems that they're unimaginably far ahead. :-)

It turns out that there are two different ways to accomplish what you seek within the HTML world, one that's an old-fashioned style that is pretty much obsolete, but still works, and the other, Cascading Style Sheets, that's much more powerful, albeit a bit more complex.

Let's start with the simple solution. To make text red, simply preface it with <font color="red"> and end with </font>. You can increase the font size, on a scale of 1 to 7, where 7 is pretty large and 1 is pretty tiny, also using the font tag, just with what we HTML folk call a different attribute. This time, instead of using color, use size="x", where you replace x with the number of your choice.

Here's how it might all fit together:

This sentence has a word buried within it that
will be shown as
<font size="6" color="red">big and red</font>
when displayed.

Not too hard, I hope.

The smarter, cooler, and frankly more powerful solution, however, is to use Cascading Style Sheets. With style sheets, you simply specify style= and then use "name: value;" pairs to get the exact result you seek. Colors are fairly similar, but font size can be specific in a zillion different ways. To keep things simple, let's use relative sizing and specify 150%:

This sentence has a word buried within it that
will be shown as
<span style="color:red;font-size:150%">big and red</span>
when displayed.

The reason that CSS is a better solution is because it allows you a tremendous level of control over the presentation of text, from colors to typefaces, size to letter and word spacing, and even line spacing in paragraphs. Far more capability than even the best standard HTML code.

If you'd really like to learn more about HTML and CSS, then may I suggest that my best-selling book Creating Cool Web Sites with HTML, XHTML, and CSS could be a splendid place to start.





Categorized: HTML and CSS   (Article 4225, Written by )
Tagged:
Previous: Change password on child's AOL (America Online) screen name?
Next: What is Tagyu?




Subscribe!
Never miss another Q&A article! Click to subscribe: Add to Google Reader Add to My Yahoo! Subscribe in NewsGator RDF XML
Comments

How do I make letters change colors and flash brightly in Html code?

Posted by: heatherb at March 30, 2008 6:50 PM

I am running under an old version of Office (Office 97) and can't reinstall it to enable the .html file type. Are there any downloads to convert a text or .doc document to an html file? - I am retired and trying to learn HTML from scratch.

Thanks.

Posted by: Mike Lambert at August 28, 2008 4:18 AM

Hi, I am New To Building With HTML and owuld just like to ask what host I should use for my FTP. I am currently using GoDaddy.com but they don't really have it that well thought out (in my opinion).

Posted by: Brett at January 24, 2010 3:40 PM

I just tried to change some things on my website. I have not done this in a year or so and thought I would remember how to do it. But sadly I must not have remembered. I changed some things on my index page in Notepad and stupidly saved the changes in .txt instead of .html. Now all my pages have the Notepad logo. How can I fix this. The pages will show up correctly if I right click on the file and open using firefox or IE. When I double click on them they come up in Notepad. Thank you so much.

Posted by: Shirley at June 17, 2010 9:59 AM

Hi, I posted a question earlier today concerning .txt and .html. I think I figured out how to fix it. I right clicked on the file went to properties and changed what to open it with. I don't think it was saved as .txt after all but was still .html but opening with Notepage instead of Firefox. Thank you for your website.

Posted by: Shirley at June 17, 2010 11:10 AM

I have something to say, now that you mention it, but ...
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Recent Entries


Search
I Need Help!
Need Help? Ask Dave Taylor!


© 2002 - 2012 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.