Beginner web designers will find it useful to know how to design the text of a web page. These include alignment, color, font size, and more.
There are several tags associated with formatting. The most commonly used "p" - paragraph. It has optional parameters that specify the appearance of the text.
The first and main parameter is "align". It determines the alignment of the text and can take the values ββ"left", "right", "center" and "justify" -
alignment on the left side, on the right, in the center and across the entire width of the block, respectively. Note that the position of the text is not set relative to the borders of the screen, but within the paragraph.
The following are the parameters βclassβ and βid.β They determine which class the given object and its identifier belong to. The attribute βstyleβ can also be attributed to this. - it sets the inline style of the block. All these properties are related to CSS, which will be discussed below.
P tag There is one drawback - with its help you can not set the appearance of the font, for example, its color or size. For these purposes, another tag is intended - "font". All its parameters determine how the text will look.
The first attribute of this tag is "color". As you might have guessed, it sets the color. This parameter can take both names ("white", "yellow", "magenta"), and values ββin the RGB system. This is done like this: first the # sign is put, and then three numbers are indicated in the
hexadecimal number system from 00 to ff or from 0 to 255 - in decimal - the amount of red, green and blue in the final color. For example, to use red, you need to write "# ff0000", yellow - "# ffff00".
The next attribute is "face". It defines the typeface. For example, it can be set to "Times New Roman" or "Tahoma."
And finally, the "size" parameter is responsible for the font size in HTML. It takes a numerical value - the size.
For example, to display the text in blue and the font "Comic Sans MS" of the fifteenth size, you need to define a tag "p" with the parameters:
color = "# 6666ff" face = "Comic Sans MS" size = "15"
There are also several tags that allow you to specify one specific type of formatting: "b" - bold, "i" - italics, "u" - underline. All of them have no parameters.
Setting attributes of text in HTML - font size, headset - is quite inconvenient. Imagine that you need to alternate blocks with different text layouts. Then for each of the tags you have to define the same attributes. This can be much more conveniently implemented using CSS cascading style sheets. For example, to create a class of pictures called "myclass" with the design as in the previous example, add the following line to the "style" tag:
#myclass {font: rgb (102,102,255) "Comic Sans MS" 15pt;}
Here, βrgb (102,102,255)β sets the color, βComic Sans MSβ sets the headset, and β15ptβ sets the font size. You can also specify the color with a name, and the font in both pins and pixels (for this you need to write, for example, "20px").
To apply this design, you need to write in the "p" tag:
class = "myclass"
In the same way you can arrange any other text. It is enough to set the parameter "class" with the value of the class you want to use.
And to create an identifier with the name "myid", you need to write in the "style":
#myid {font: rgb (102,102,255) "Comic Sans MS" 15pt;},
and in the tag "p" set the attribute "id" with the value "myid".
The class and identifier are almost the same thing. At the same time, one tag can have both the first and the second:
class = "myclass" id = "myid"
There are two ways to change the appearance of text - HTML and CSS. If you need to make one or two blocks, then use HTML. And for a large number of paragraphs with the same formatting, CSS is more convenient.
As you can see, changing the font size in HTML is a snap. The main thing in programming is practice, so try to train more, and you will succeed!