"; 2. Use the style attribute in the table tag and add the "width: width value;" style."/> "; 2. Use the style attribute in the table tag and add the "width: width value;" style.">

Home>Article>Web Front-end> How to set table width in HTML

How to set table width in HTML

青灯夜游
青灯夜游 Original
2021-05-17 15:49:04 16741browse

How to set the table width in HTML: 1. Directly use the width attribute of the table tag, with the syntax "

How to set table width in HTML

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

After adding a border to the table tag using the border attribute, the default width is determined by the content inside:

商品 价格
T恤 ¥100
牛仔褂 ¥250
牛仔库 ¥150

Rendering:

How to set table width in HTML

Then How to set table width?

Method 1: Use the width attribute of the table tag

商品 价格
T恤 ¥100
牛仔褂 ¥250
牛仔库 ¥150

Rendering:

How to set table width in HTML

Method 2: Use the style attribute to add the "width: width value;" style

商品 价格
T恤 ¥100
牛仔褂 ¥250
牛仔库 ¥150

Rendering:

How to set table width in HTML

( Learning video sharing:css video tutorial, "html video tutorial")

"; 2. Use the style attribute in the table tag and add "width :width value;" style.

The above is the detailed content of How to set table width in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn