CSS grid elements

PHPz
Release: 2023-09-14 08:25:02
forward
709 people have browsed it

CSS 网格元素

The grid element in CSS has a parent element and a child element. Here is an example of creating a grid using 6 elements.

Example

Live Demonstration

<!DOCTYPE html>
<html>
   <head>
      <style>
         .container {
            display: grid;
            grid-template-columns: auto auto;
            padding: 20px;
         }
         .ele {
            background-color: orange;
            border: 2px solid gray;
            padding: 25px;
            font-size: 20px;
            text-align: center;
         }
      </style>
   </head>
   <body>
      <h1>Game Board</h1>
      <div class = "container">
         <div class = "ele">1</div>
         <div class = "ele">2</div>
         <div class = "ele">3</div>
         <div class = "ele">4</div>
         <div class = "ele">5</div>
         <div class = "ele">6</div>
      </div>
   </body>
</html>
Copy after login

The above is the detailed content of CSS grid elements. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!