Aligning the middle horizontally html. Ob'ednannya sredok. HTML: ob'ednannya osredkiv. Apply it
table It's best to look at the example of a simple table, the HTML code for which is shown in Listing 5.10.
This is a table, each box is numbered - it will be easier for us to give it to you. In Fig. 5.2 Indications as it appears in the Web browser window.
Now let's look at the table in Fig. 5.3.
Here we can see a discussion of some of the middle ones. It can be seen that the middle of the mutes were angry into one. How can you earn money?
Especially for this tag
To combine a bunch of middles horizontally into one, you need to cut out such pieces.
1. Find the HTML tag (
2. Enter the COLSPAN attribute into the new one and select the number of rooms to eat, respect and most importantly among them.
3. Vidality tags (
Let's take a look at tables 2 and 3 (div. listing 5.10). The corrected code fragment that creates the first row of this table can be found in Listing 5.11.
So we can create the middle ones 4 + 5 and 12 + 13 + 14 + 15.
Combine the middles vertically into smaller pieces. The axis of the goods is necessary for this vyconate.
1. Find the row (tag) in the HTML code that contains the first row to eat (as you move the rows down).
2. Find the tag in the code of this row (
3. Enter the ROWSPAN attribute into the new one and assign its strength combined middles, With respect and priority from them.
4. Look at the upcoming rows and remove tags from them (
We've lost consolidate businesses 1 and 6 of our table. Listing 5.12: Correct the fragment of the HTML code (correct the first and the other row).
We are extremely grateful that we saw from another row the tag that creates the sixth middle, the fragments of wine joining the first middle.
Nina doesn’t get stuck very often. However, earlier, during the development of tabular Web design, it was important to create a table without about edible middles. So anyway, you won’t know about him.
Lesson 11.
Combining the middle of the table.
In this lesson we will continue to include tables, and we will look at two more attributes for the tag <td>, which indicate the obedience of middles. Having marveled at the little ones below, you will understand what obedience exists.
The table is shown left-handed and has a normal structure. In the right table in the first row, two middles are combined with each other, creating one large volume.
The consolidation of these attributes is a little more important than the consolidation of others. He himself was taught a profound lesson.
The colspan attribute.
Attribute colspan Vikorist is used to unite the centers horizontally. The value of the attribute indicates the number of middles that can be combined into one.
Respect! It is very important that the quantity of common and basic middles of one row equals the quantity of the middle of another row. Let's take a look at the butt to the right of the table of the first little one. The top row contains only one large pile, which consists of two primary ones, and the bottom row contains two primary pockets.
Below is a version of the correctly written code:
Explanation before the code:
Top row <tr> May have one middle <td>, for which prescriptions the attribute colspan zi values 2
. This means that this middle combines 2 middles, so this middle replaces 2 middles. Another row <tr> May 2 primary middles <td>.
It turns out that in the top row we have two interconnected middles, and in the bottom row there are two primary middles. This is very old, and the code is written correctly.
Now the butt of the code has a wider scope:
Explanation before the code:
The mercy is that the first row <tr> revenge not two middles <td>, and three, at that hour the other row <tr> revenge two middles <td>.
Looking at the code, it is visually clear that the number of middle rows in the rows is the same, only the number of tags <td> however. Ale one of the tags <td> May attribute colspan zi values 2
This means that this one middle takes the place of two.
The rowspan attribute.
Attribute rowspan Vikorist is used to align the vertical centers. The principle of action is the same as in the attribute colspan.
Explanation before the code:
Top row <tr> there are three middles <td> for one of them the attribute rowspan zi values 3
. This means that this middle combines 3 middles (one task attribute + 2 lower vertical middles). As I already said, the first row has 3 middles, which means that the bottom two rows are also responsible for three middles. Look at the code, mi bachimo, the bottom two rows <tr> to languish more than two times <td>, but don’t forget that the first middle of the top row has taken its place + another place of the two middles that are under it. This means that the number of middles in the skin in the adjacent row is equal to three.
3.8. Combining the middle of the table
In practice, there is a large number of tables, in which one middle contains a number of middles in height and width (div. Fig. 3.2). HTML systems use additional attributes: colspan and rowspan. The colspan attribute indicates the number of middles that extend this middle horizontally, and rowspan - vertically.
In Fig. Figure 3.12 shows a table with combined middles. The header of the table is in the order, which includes all three numbers in the row. Place two more centers on the table, each of which joins the two centers vertically. The code for such a table is given in Listing 3.7.
Small 3.12. Table with common middles
Listing 3.7. An example of the selection of attributes of the center
The middle combines all the middles of the row | ||
---|---|---|
Middle for two rows | Middle 2x2 | Middle 2x3 |
Middle 3x2 | Middle 3x3 | |
Middle for two rows | Middle 4x2 | Middle 4x3 |
Middle 5x2 | Middle 5x3 |