95 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			95 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html lang="zh-CN">
 | |
| <head>
 | |
|     <meta charset="UTF-8">
 | |
|     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | |
|     <title>工具类网站</title>
 | |
|     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css">
 | |
|     <style>
 | |
|         :root {
 | |
|             --tile-size: 120px; /* 固定宽度为120px */
 | |
|         }
 | |
|         body {
 | |
|             margin: 0;
 | |
|             font-family: Arial, sans-serif;
 | |
|             display: flex;
 | |
|             justify-content: center;
 | |
|             align-items: flex-start; /* 对齐到顶部 */
 | |
|             height: 100vh;
 | |
|             padding-top: 50px; /* 距离上边距50像素 */
 | |
|         }
 | |
|         .tile-container {
 | |
| 	        display: grid;
 | |
|             grid-template-columns: repeat(auto-fill, minmax(var(--tile-size), 1fr)); /* 自动填充列 */
 | |
|             max-width: 90%;
 | |
|             padding: 10px;
 | |
|             grid-row-gap: 10px;
 | |
|             grid-column-gap: 10px;
 | |
|             justify-content: center;
 | |
|         }
 | |
|         .tile {
 | |
|             width: var(--tile-size); 
 | |
|             height: var(--tile-size);
 | |
|             color: #fff;
 | |
|             display: flex;
 | |
|             flex-direction: column;
 | |
|             justify-content: center;
 | |
|             align-items: center;
 | |
|             text-align: center;
 | |
|             border-radius: 10px;
 | |
|             box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
 | |
|             cursor: pointer;
 | |
|             transition: transform 0.3s, box-shadow 0.3s;
 | |
|             background-color: #0078D7; /* 默认背景颜色 */
 | |
|         }
 | |
|         .tile:hover {
 | |
|             transform: scale(1.05);
 | |
|             box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
 | |
|         }
 | |
|         .tile i {
 | |
|             font-size: calc(0.35 * var(--tile-size)); /* 图标大小为30px */
 | |
|             margin-bottom: 10px; /* 保证图标和文字之间的间距 */
 | |
|         }
 | |
|         .tile span {
 | |
|             font-size: calc(0.11 * var(--tile-size)); /* 工具名称字体大小适应磁贴 */
 | |
|         }
 | |
|     </style>
 | |
| </head>
 | |
| <body>
 | |
|     <div class="tile-container" id="tileContainer">
 | |
|         <div class="tile" style="background-color: #0078D7;" onclick="handleTileClick('otp.html')">
 | |
|             <i class="mdi mdi-qrcode"></i>
 | |
|             <span>OTP二维码生成器</span>
 | |
|         </div>
 | |
|         <div class="tile" style="background-color: #28a745;" onclick="handleTileClick('text_to_qrcode.html')">
 | |
|             <i class="mdi mdi-qrcode-edit"></i> 
 | |
|             <span>文字转二维码</span>
 | |
|         </div>
 | |
|         <div class="tile" style="background-color: #dc3545; display: none" onclick="window.open('tool3.html', '_blank')">
 | |
|             <i class="mdi mdi-bell"></i> 
 | |
|             <span>工具3</span>
 | |
|         </div>
 | |
|         <div class="tile" style="background-color: #fd7e14; display: none" onclick="window.open('tool4.html', '_blank')">
 | |
|             <i class="mdi mdi-calendar"></i>
 | |
|             <span>工具4</span>
 | |
|         </div>
 | |
|         <!-- 这里可以添加更多工具的磁贴,每个磁贴可以设置不同的背景颜色 -->
 | |
|     </div>
 | |
| 
 | |
|     <script>
 | |
|         function handleTileClick(page) {
 | |
|             const currentPath = window.location.pathname;
 | |
|             let targetUrl;
 | |
| 
 | |
|             if (currentPath.includes('index.html')) {
 | |
|                 targetUrl = page;
 | |
|             } else {
 | |
|                 targetUrl = `tools/${page}`;
 | |
|             }
 | |
| 
 | |
|             window.open(targetUrl, '_blank');
 | |
|         }
 | |
|     </script>
 | |
| </body>
 | |
| </html>
 |