Example of HTML rules attribute with table element

Атрибут rules

По своим свойствам схожий с атрибутом frame, только имеет другие значения и влияет на ячейки, а не на всю таблицу.

Как правильно задавать?

Какие значения могут быть записаны в атрибут?

  • all — все ячейки ограждены границей.
  • groups — граница рисуется только для сгруппированных ячеек через теги < thead >, < tfoot >, < tbody >, < colgroup >или < col >.
  • cols — рамка применяется только между колонками.
  • none — отмена вывода границ.
  • rows — рамка применяется только между строчками.

В каких тегах применяется?

Пример использования

DOCTYPE HTML> html> head> meta charset="utf-8"> title>Атрибут colstitle> head> body> table rules="none"> tr> td>linktd> td>sourcetd> tr> tr> td>linktd> td>sourcetd> tr> tr> td>linktd> td>sourcetd> tr> table> body> html>

Источник

Html table rules rows

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more

Attribute of Create An HTML Table Quickly & Easily With Our Code Example What does do? Was used to specify the display of internal borders between rows and colums. This attribute has been deprecated. Use CSS to style table borders instead.

The Rules Attribute has been Deprecated This attribute has been deprecated and should not be used. Browser support for this attribute is limited and using it may produce unexpected results. Instead, use CSS to style tables.

The RULES Attribute

RULES , an HTML 4.0 attribute, indicates if there should be internal borders in the table. We’ll go over each of the values of RULES and demonstrate how they are used. RULES and FRAME have an annoying way of changing each other’s defaults. To simplify your life, here’s a rule of thumb: if you use RULES also use FRAME and BORDER . It’s easier to avoid getting confused.

The NONE Value for the RULES Attribute

RULES=NONE means that there are no inside borders. RULES=NONE is the default if you don’t use BORDER or set it to zero, but otherwise must be explicitly stated to have no inside borders. Note that currently Netscape does not recognize RULES .

When applied to a table, that value gives us this result:

Name Food
Starflower stir fied tofu
Miko vegetable rice soup
Andy hummus
Ping french toast

The ALL Value for the RULES Attribute

RULES=ALL indicates that all the internal borders should be visible. RULES=ALL is usually used in conjunction with FRAME=VOID so that there are outer borders but no inner borders.

When applied to a table, that value gives us this result:

Name Food
Starflower stir fied tofu
Miko vegetable rice soup
Andy hummus
Ping french toast

The COLS Value for the RULES Attribute

COLS indicates that there should be borders between the columns but not between rows.

When applied to a table, that value gives us this result:

Name Food
Starflower stir fied tofu
Miko vegetable rice soup
Andy hummus
Ping french toast

The ROWS Value for the RULES Attribute

RULES=ROWS indicates that there should be borders between rows but not between columns.

When applied to a table, that value gives us this result:

Name Food
Starflower stir fied tofu
Miko vegetable rice soup
Andy hummus
Ping french toast

The GROUPS Value for the RULES Attribute

RULES=GROUPS allows you to put borders between groups of table cells. There are two ways cells can be grouped: by row and by column. Let’s go over each of them. Note that currently Netscape does not recognize RULES .

Grouping By Row

To group by row use the , , tags. indicates the header rows of the table, indicates the main body of the table, and indicates the bottom rows. So, for example, this code creates a table with three groups. Borders appear just between groups:

 
NameFoodPrice
Starflowerstir fied tofu5.95
Mikovegetable rice soup4.95
Andyhummus3.95
Pingfrench toast5.95
Total20.80

Here’s how that table renders:

Name Food Price
Starflower stir fied tofu 5.95
Miko vegetable rice soup 4.95
Andy hummus 3.95
Ping french toast 5.95
Total 20.80

Grouping By Column

To group by column use the tag and its SPAN attribute. takes a little getting used to because it doesn’t actually go around any table cells. It goes at the top of the table code where it sets rules about the table columns including which are grouped together. to indicates how many columns are in each group. If you leave SPAN out then it is assumed the group has just one column. So, for example, the following code says that the first column is in a group by itself and the three after that are together in a group. Notice that requires an end tag. Borders will go only between the groups:

Dropping those lines of html before the table contents produces this table:

Weekday Date Manager Qty
Monday 09/11 Kelsey 639
Tuesday 09/12 Lindsey 596
Wednesday 09/13 Randy 1135
Thursday 09/14 Susan 1002
Friday 09/15 Randy 908
Saturday 09/16 Lindsey 371
Sunday 09/17 Susan 272

Values of the rules Attribute

All Attributes of table Element

Attribute name Values Notes
frame hsides
void
vsides
The frame attribute was used to define the visible borders of a table. It is now deprecated and should no longer be used.
height
hspace
rules all
cols
groups
none
rows
summary
width

Claire is seasoned technical writer, editor, and HTML enthusiast. She writes for HTML.com and runs a content agency, Red Robot Media.

Источник

Атрибут rules

Атрибут / параметр rules (от англ. «rules» ‒ «правила, линии») указывает, какие линии границ будут отображаться между ячейками таблицы.

Поддержка браузерами

Спецификация

Верс. Раздел
HTML
2.0
3.2 Tables
4.01 11.3.1 Borders and rules
rules = none|groups.
DTD: Transitional Strict Frameset
5.0 4.9.1 The table element
5.1 4.9.1. The table element
XHTML
1.0 Extensible HyperText Markup Language
DTD: Transitional Strict Frameset
1.1 Extensible HyperText Markup Language

Значения

all Правила (линии) появятся между всеми строками и столбцами. cols Правила (линии) будут появляться только между столбцами. groups Правила (линии) будут отображаться только между группами строк (элементы thead , tfoot и tbody ) и группами столбцов (элементы colgroup и col ). none Правила (линии) не отображаются. rows Правила (линии) будут появляться только между строк.

Значение по умолчанию: « none ».

Источник

HTML rules attribute

The purpose of the HTML rules attribute is to specify which rulings (between rows and columns) are to be shown in a table.

Supported elements

HTML rules attribute supports table element.

Type of value

Values Description
all All rulings are shown.
cols Only column rulings are shown.
groups Only group rulings are shown.
none No rulings are shown.
rows Only row rulings are shown.

Default value

Default value of HTML rules attribute is all

Supported doctypes

HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.

Example of HTML rules attribute with table element

       
   
   
   

html rules attribute with table element

View this example in a separate browser window

Test your Programming skills with w3resource’s quiz.

Follow us on Facebook and Twitter for latest update.

  • Weekly Trends
  • Java Basic Programming Exercises
  • SQL Subqueries
  • Adventureworks Database Exercises
  • C# Sharp Basic Exercises
  • SQL COUNT() with distinct
  • JavaScript String Exercises
  • JavaScript HTML Form Validation
  • Java Collection Exercises
  • SQL COUNT() function
  • SQL Inner Join
  • JavaScript functions Exercises
  • Python Tutorial
  • Python Array Exercises
  • SQL Cross Join
  • C# Sharp Array Exercises

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook

Источник

Читайте также:  Python docx save as pdf
Оцените статью