Lesson 7. Text and background color in HTML.
Date: 2008-12-05
How to set the background and text color on a web page?
By default, the color of text and, in general, any font on web pages is always black (#000000 ). But we can always set absolutely any color that we like and looks decent or more suitable for the design of a particular site.
Set the text color
In HTML, the color of text, font, background, and other elements can be set in two ways:
1. Method 1. In pair tags
attribute is written
Comments on this article (lesson):
Andrey! What a wonderful site you have! I have been using it regularly for the second week now: I have been studying your lessons and video tutorials; I read your literature and download programs; I'm taking my first steps in web programming! And, most importantly, I can do it!!! And I'm not a physicist at all, but a lyricist! And anyone who visits my literary site can be convinced of this: "POEMS BY OLEG GUZ" My details: e-mail: [email protected] website: http://sites.google.com/site/stihiolegguz/
check the code carefully
I've tried changing the background color and it doesn't work! How to change the background color?
Good day to everyone who wants to learn and learn something new! Have you ever paid attention to the appearance, during the development of which the creators were too lazy to decorate the background of the pages? And I turned. This looks bad. Often, due to the lack of divisions between different types of information that we are used to, it is mixed up and there is simply no desire to look further at such a web resource.
So that such a disaster does not happen to me, I decided to write an article on the topic: "How to make a page background in html." After reading the publication, you will learn what tools you can use to set the background design, how to make the background fixed or changing, and much more that will help make your site attractive. And now let's start!
Basic tools for setting the background of web pages
To set a background image, web language designers provided the background attribute. It is available in both , and css.
In the markup language, this is an attribute of the body tag, and in style sheets, it is a universal property that allows you to set up to 5 background characteristics at the same time. Background is a fairly flexible element that can be used to set the background in the form of a single color, a colored image, or even an animation.
So, to set the background image via the html unit
just write this code: ...
and instead of the words "file address" insert the path to the picture.
However, notice! If you want to see a one-color canvas as a background, specified by a value from the color palette, then this is done using the bgcolor attribute.
For example,
...
, we have set a black background for our site.
Colors in css and html are specified either by an English word (for example, red) or a special code that consists of the # sign and six characters after it (for example, #FFDAB9).
When typing the second option in specialized software products for developers, the palette will automatically appear in front of you. If you have just started to study these web languages, then you can peep the color code on the Internet.
Background as a property in cascading style sheets
It is set either in a separate file with css styles, or in an element