answersLogoWhite

0


Best Answer

Here is how Look! Styles and colors

This text is in Verdana and red

This text is in Times and green

This text is 30 pixels high

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

The preferred method of adding color to text is to use CSS. It would look something like this...

<span style="color: red;">This is something red.</span>

You can also modify background color by changing "color" to "background-color" in the style attribute above. The colors can be words (red, blue, black, etc), full hexadecimal (#FF0000, #0000FF, #000000, etc), short hex (#F00, #00F, #000, etc), or RGB (rgb(255,0,0), rgb(0,0,255), rgb(0,0,0), etc). There is limited experimental and provisional support for RGBA (like RGB, but with an "alpha" transparency value), HSL (hue, saturation, and luminosity values), and HSLA (HSL with alpha).

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

To change the background color of an element in X/HTML you use a style declaration. This declaration can be in a separate style-sheet, in an "inline" style-sheet in the HEAD section of the HTML page, or as an attribute.

For simplicity, let's pretend you want to change the color of a paragraph whose class attribute is set to "magic."

<p class="magic">Paragraph stuff ensues.</p>

In the style sheet you create a rule to reference that paragraph. The simplest form of that rule would be:

.magic {}

To set the background, use the CSS background-color property. This property can take either a string of one of 170 "named colors" (for instance "blue") or an RGB value for the color. RGB values can be either hexadecimal or use rgb() syntax. The following are all equivalent:

.magic { background-color: blue; }

.magic { background-color: #0000ff; }

.magic { background-color: #00f; } // shortcut for repeated RGB values

.magic { background-color: rgb (0, 0, 255); }

.magic { background-color: rgba(0, 0, 255, 1 ;}

The 3rd example uses a shortcut that allows you to drop the second digit (F here is a digit) from the RGB pairs is all of those pairs have the same digit in both places. You can do this for white, for instance, and #ffffff becomes #fff. But not if you've got a light grey like #edeebe.

The last two examples use the decimal equivalents to the RGB values (ff = 255) and the last one also uses the alpha channel. The alpha channel is a number between 0 (transparent) and 1 (opaque) that lets you adjust the opacity of the color itself. This does not work in older browsers.

XHTML demands that RGB hex values are always lower case. HTML 4 and 5 don't care (but if you always use lower case you can't goof it up.)

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

u have to be super smart

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you change background color in HTML?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the background code for a HTML document?

A background can be added on CSS. ex: #body {background: url(../images/bodybg.jpg) repeat-x;}The HTML code for background color is Note: The code must be put inside the body tag, that is between and of your HTML script and the values of color can be change accordingly. For example, if you want to put gray background color you simply change the value to "#727272" or "#000000" for black if you want.


What is bgcolor?

bg color is the abbreviation of background color there is a command used in HTML which set the background color which u want


What is the code of backround in HTML?

Background can be easily added into the HTML code. in the &lt;style&gt; element you can add background-color="red".


Which HTML tag would be apply the bgcolour attribute to change the background color of single table row?

The tr tag.


What is the preferred way for adding a background color for HTML?

The preferred method for adding background color to an element is not through HTML, but rather through CSS (i.e. the background-color statement). Older versions of HTML support the now-deprecated (and soon obsolete) bgcolor element attribute.


How do you add a background color for all h1 elements?

h1 { color: #f00; } Yields red H1 headers in shorthand for #ff0000 that is used in HTML. This will work in all cases unless an ID or a class overrides it.


How can the background color for a website be changed using html code?

To change the color, one simply adds a new color code between the and tags. Lists of color codes can be found online at sites like quackit.


What is a HTML code for a background on tinierme?

If for an image: &lt;body background="images/background.jpg"&gt; or if for a color: &lt;body bgcolor="#000000"&gt;


How do you change your howrse page background color?

you can't change the whole color but you cn add layouts and banners and stuff. Using HTML you can put this code fragment within the head section: &lt;style&gt; body{ background:lightblue } &lt;/style&gt;


How do you change the background color in word 2007?

go to layout, then click on color (it has a picture of a paint bucket) and click on a color to change your background


HTML for adding a background color?

It's not HTML. Background color is a CSS style. You need to put in either a stylesheet, or attach the style attribute to the tag whose background color you're trying to set. For instance: &lt;p style="background-color:blue;"&gt;This paragraph would have a blue background.&lt;/p&gt; Colors in CSS can be set using names (there's 170 or so of them) Via a hexadecimal RGB value: &lt;p style="background-color:#b3b3b3;"&gt;This a meduim gray. The pairs of hex digits correspond to RGB.&lt;/p&gt; Using RGB directly: &lt;p style="background-color: rgb(179,179,179);"&gt;This is the same color as #b3b3b3&lt;/p&gt; And using RGBA (which gives you an alpha channel, letting you set transparency) &lt;p style="background-color: rgba( 179, 179, 179, .5 );"&gt;This paragraphs background color would be 50% transparent.&lt;/p&gt;


How do i change my Tumblr background everytime i click on customize appearance and themes the custom HTML isn't there?

After you click on the "Customize Appearance" link, the bar on the left should show either your selected theme or "custom theme." You should see an "Edit HTML" button next to it. Clicking on that will bring you to the HTML of your theme. You can change your background on the HTML. Or instead of going to the custom HTML, you can go under Appearance and you can either upload a picture for your background or change the colour of it.