简体   繁体   English

如何使用HTML / CSS创建1,5''正方形

[英]How to create a 1,5'' square with HTML/CSS

I want to create an interface for a user. 我想为用户创建一个界面。 That interface have 1,5". Below is the code: 该接口有1,5“。下面是代码:

 .test{ height: 52px; width: 52px; background: black; margin-left: auto; margin-right: auto; } 
 <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="test"></div> </body> </html> 

I think those 1,5" are too smaller. What I did to get the 52px was: inch -> cm -> pixels 我认为这些1,5“太小了。我得到52px的方法是:英寸->厘米->像素

Maybe there is a right way to create that? 也许有正确的方法来创建它?

Why not just use in for the unit? 为什么不直接用in为单位?

 .test{ height: 1.5in; width: 1.5in; background: black; margin-left: auto; margin-right: auto; } 
 <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="test"></div> </body> </html> 

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

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