Home / Articles / Programming languages / Markup languages / HTML & CSS / Table parameters in HTML

Table parameters in HTML

Table parameters in HTML
 
Table parameters in HTML
  • Currently 0 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 0/5 (0 votes cast)

Thank you for rating!

You have already rated this page, you can only rate it once!

Your rating has been changed, thanks for rating!

Log in or create a user account to rate this page.


To change table properties use a set of parameters that are added to the tag table. The general syntax is as follows.

<table parameter1="..." parameter2="..."> 

Description of the parameters and their values are given in table 1.

Table 1. Parameters of the table tag.

Parameter

Value

Description

Example

align

left
right
center

Table aligning.

<table align="center">

background

URL

Sets background image of the table.

<table background="pic.gif">

bgcolor

#rrggbb

Sets background color of the table.

<table bgcolor="#ff9900">

border

n

Border width in pixels.

<table border="1">

bordercolor

#rrggbb

Border color.

<table bordercolor="#333333">

cellpadding

n

Cell padding. Distance from the cell border to its content.

<table cellpadding="7">

cellspacing

n

Cell spacing.

<table cellspacing="3">

cols

n

Specifies the number of columns in the table, this helps the browser to display the table.

<table cols="3">

nowrap

 

No line breaks in the text.

<table nowrap>

frame

void
above
below
lhs
rhs
hsides
vsides
box

Sets frame type of a table.

<table frame="hsides">

rules

all
groups
cols
none
rows

Determines where to draw borders between cells.

<table rules="cols">

width

n
n%

The minimum width of a table can be specified in pixels or in percentage.

<table width="90%">

Note: 

  • The table, unless otherwise specified, is always aligned to the left;
  • By default, the table is displayed without borders;
  • If the table width is not specified, it's adjusted to fit the contents of the cells;
  • There may be unnecessary empty spaces between the cells. This is due to the fact that the line breaks in the HTML code automatically create extra spaces in the table. To get rid of this, put the code inside the tag tr in one line.

 

Read also

Creating tables in HTML

Creating tables in HTML

Table alignment in HTML

Table alignment in HTML

Tables and borders in HTML

Tables and borders in HTML

Cell parameters in HTML

Cell parameters in HTML

Post comment

basicuse.net
html5_css
106160485398655174790

Quick navigation

General navigation