Home > Web Front-end > CSS Tutorial > How to remove margins from table in css

How to remove margins from table in css

WBOY
Release: 2021-12-08 15:21:14
Original
3907 people have browsed it

在css中,可以利用“border-style”属性让table元素去掉边框,该属性的作用就是设置元素的边框样式,当属性的值为“none”时,会去掉元素的边框,语法为“表格元素{border-style:none;}”。

How to remove margins from table in css

本教程操作环境:windows10系统、CSS3&&HTML5版、Dell G3电脑。

css怎样让table去掉边距

在css中,想要去掉table元素的边框,可以利用border-style属性,该属性的作用就是设置元素的边框样式,想要去掉元素的边框样式只需要将属性值设置为none即可。

示例如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    table,td{
        border-style:none;
    }
    </style>
</head>
<body>
<table border="1">
  <tr>
    <td>Month</td>
    <td>Savings</td>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
</body>
</html>
Copy after login

输出结果:

How to remove margins from table in css

(学习视频分享:css视频教程

The above is the detailed content of How to remove margins from table in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template