简体   繁体   English

表格 HTML、CSS 中的网格

[英]Grid in table HTML, CSS

I need help, I have a document that I need to generate in HTML CSS then that will be transformed into PDF.我需要帮助,我需要在 HTML CSS 中生成一个文档,然后将其转换为 PDF。

I have a table to do by putting information like below (the color is not important):我有一张表格要做,如下所示(颜色不重要):

在此处输入图像描述

Can we put the grid directly in a tag, maybe like that?我们可以将网格直接放在标签中吗,也许是这样?

// example
<td class="grid">
  <p>
   ...text
  </p>
</tp>

I have tried different ways but I can't get the results I wanted.我尝试了不同的方法,但我无法得到我想要的结果。

This will apply 2 columns on one row这将在一行上应用 2 列

add .grid-container to the td ,.grid-container添加到td

and col1 and col2 to each P under the containercol1col2到容器下的每个P

 .grid-container { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; gap: 0px 0px; grid-template-areas: "col1 col2"; }.col1 { grid-area: col1; }.col2 { grid-area: col2; }
 <div class="grid-container"> <div class="col1"></div> <div class="col2"></div> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM