[英]Why isnt my html and css grid not working?
<html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> </style> </head> <body> <div style=" display: grid; grid-template-columns: 100px, 100px;"> <div style="background-color: lightblue;">div 1</div> <div style="background-color: lightpink;">div 2</div> </div> </body> </html>
I've been trying to make a grid in HTML and CSS and it's not working.我一直在尝试用 HTML 和 CSS 制作网格,但它不起作用。 Im new to CSS and HTML so please tell me what I did wrong thanks!我是 CSS 和 HTML 的新手,所以请告诉我我做错了什么,谢谢!
There was just one error you have made in grid-template-columns there must be no comma should be included, so it must look like this grid-template-column:100px 100px;你在 grid-template-columns 中只犯了一个错误,不能包含逗号,所以它必须看起来像这样 grid-template-column:100px 100px;
<html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> </style> </head> <body> <div style=" display: grid; grid-template-columns: 100px 100px;"> <div style="background-color: lightblue;">div 1</div> <div style="background-color: lightpink;">div 2</div> </div> </body> </html>
You can use grid-template-columns: auto in this case.在这种情况下,您可以使用grid-template-columns: auto 。 Hope that solves you希望能解决你
<html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div style="display: grid; grid-template-columns: auto auto auto;"> <div style="background-color: lightblue;">div 1</div> <div style="background-color: lightpink;">div 2</div> <div style="background-color: rgb(34, 192, 3);">div 2</div> </div> </body> </html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.