ComputersProgramming

How to make an HTML table. Table of colors

Novice webmasters have to deal with a lot of problems. It would seem that today you can use templates for creating your own sites, but the trouble is, they do not always have the necessary properties, and then you have to either create a website design from scratch, or make changes to the already existing code. This is where you need knowledge of HTML code and minimal notions about how to set the background and color of the page, insert a picture or video, make a table in HTML.

Get started on the table

One of the most difficult things in the layout of an HTML page is tables. And the problem is not in the complexity of the tags, which, in fact, are not so difficult to remember, but that when writing the code, you can easily make mistakes - forget to write down an extra line or cell, write the text not right where you want it, and other small things . And the larger the table, the greater the chance to make a mistake.

Therefore, when starting to create a table in HTML, we recommend that you focus as much as possible and not be distracted.

First of all, you should draw a future table on a sheet of paper, marking what will be in which cell you will be in, and also noting for yourself the basic parameters of this or that element.

Next, count the number of rows in the table, and the number of cells in each row. We also recommend to note such items as the presence of pictures in the table, background color, borders, text. Only after that you can start creating an HTML table using the recorded information.

Editor

So, you created a table layout. Now you have to select the appropriate editor to create it. You can select special site designers and make a table in them. Using this software, creating a table is not more difficult than in a Word document. You can select a program such as FrontPage. Despite the fact that the program is quite old, with its help you can create good sites, besides, you can find more than one tutorial on it.

If you want to create a table in HTML using special code, you can use for this purpose a usual notepad or a regular Word document. However, here you will have to work hard, because you will have to write code for a long time.

You can use the editor built into the site engine itself. So, when creating an entry in many engines, it is possible to add different elements, including tables. Even if the basic capabilities of the editor do not satisfy you, making changes to the code will be easier than writing it from scratch.

Tags

Regardless of which editor you use, before you start creating in the html table, you should remember the main tags. There are three of them -

, and
. Note that all tags are paired. The first tag denotes the table as a whole, the second specifies the string, the third specifies the cell within the string.

A bit more about each of the tags. The table always starts with the

tag and ends with . For any browser, this is a symbol for the fact that the table is before it. Further lines are written that open and end the tag. Each line uses the
and tags to specify the number of cells.

Thus, the code of the table 2x2 will look like this:

You can insert a table into the HTML of the page by copying it from the selected editor.

Parameters of tables, rows and cells

So, we disassembled the basic code. Now let's talk about how to improve the table, make it brighter and more attractive. To do this, you need to know the basic parameters of the tags. They are written inside the opening tag, with an equal sign after each parameter, and then assigns its value, taken in quotation marks. For example, the background in the HTML table is set like this:

.

Let's list some basic parameters that will be most useful for you. Let's start with the table itself.

So, you can set the width of the border border parameter, which can take any numerical value. The border color sets the bordercolor. The background is set by bgcolor.

If you want to make the background of the table a picture, use the background, while you should prescribe the URL of the picture.

Align the page content around the table with the align parameter, which can take the values left, center, and right.

You can use the

paired tag, which is assigned immediately after the opening tag.

A little about the parameters of the string. The color of the cells in the string is specified using bgcolor. You can align the text horizontally with the parameter align (left, center or right), vertically - valign (takes the values top, middle or bottom).

Regarding the cell, it can be noted that the background color and the background picture are set for it using the same parameters as for the whole table. Align text with the align and valign options.

There are also special parameters - colspan and rowspan. With the help of the first one you can set the number of columns to which the cell will extend. The second one specifies the number of lines to which this cell can extend.

That's all the most useful options.

Table of colors

Let's say a few words about such a useful thing as the color table. It is used to set the page background, the color of text, links and other elements. The table of colors contains about 216 colors and shades. Each of them has its own hexadecimal code.

The code itself starts with a lattice character and contains three pairs of numbers or letters. For example, the green color in the table has code # 007F0. Each pair indicates the intensity of one of the three primary colors - red, green and blue. Using the table, you can select the color you need and set it using the code.

If you can not use the table, you can set the color using its name in English.

Content

A few words about the content itself. Of course, most often we can see the text in the HTML table, but that does not mean that we can only place it there. Cells and lines can also contain drawings, audio and video files, links.

To put text or any other information in a cell (a line), it is necessary to register it between two tags. For example:

name . The cell displays "Name".

You can place graphic information and media files with special tags - ,

Advice

Finally give some useful tips that will help you quickly create an HTML table of any complexity.

When writing a table, we recommend first register the tags of the table and its main parameters. Then write the line tags. Start each pair with a new line. So you will see how many rows in your table. Also, write down the string or string parameters if they are different from the basic ones. Then we advise starting to register each cell, also from a new line. And it is desirable to make one or two indents Tab from the edge. Thus, you will see the structure of the code pretty clearly.

The contents of cells and strings are advised to be written already at the very end, when the table frame is ready.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.atomiyme.com. Theme powered by WordPress.