鱼C论坛

 找回密码
 立即注册
查看: 719|回复: 3

为什么改px的数值没有

[复制链接]
发表于 2022-9-9 15:58:12 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="">



<title>无限资源</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="">
<meta name="description" content="最简易网站">
<meta name="author" content="">
<style>
div{display:inline;
                   }
.h1{height:600px;
             width: 500px;
                       border: 3px dotted green;}
.h2{background: url("     ")
           height:600px;
             width: 500px;
                 border: 3px dotted green;}
</style>
</head>
<boby>
<div class="h1"><a href="     " target="      ">娱乐</a></div>
<div class="h1"><a href="     " target="      ">娱乐</a></div>
<div class="h1"><a href="     " target="      ">娱乐</a></div>
<br>
<div class="h1"><a href="     " target="      ">娱乐</a></div>
<div class="h1"><a href="     " target="      ">娱乐</a></div>
<div class="h1"><a href="     " target="      ">娱乐</a></div>
<br>
<div class="h1"><a href="     " target="      ">娱乐</a></div>
<div class="h1"><a href="     " target="      ">娱乐</a></div>
<div class="h1"><a href="     " target="      ">娱乐</a></div>
</boby>
</html>

评分

参与人数 1荣誉 +5 鱼币 +5 贡献 +3 收起 理由
python爱好者. + 5 + 5 + 3 对不起!

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-9-9 21:09:47 | 显示全部楼层


因为 div 这个块元素被你设置为 inline 行内元素了

行内元素不能设置宽高,它是通过内部内容来撑开的

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-9-10 14:16:40 | 显示全部楼层
Twilight6 发表于 2022-9-9 21:09
因为 div 这个块元素被你设置为 inline 行内元素了

行内元素不能设置宽高,它是通过内部内容来撑开 ...

有办法强制吗
做个九宫格而已
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-9-10 16:22:04 | 显示全部楼层
沐雨尘枫 发表于 2022-9-10 14:16
有办法强制吗
做个九宫格而已

做九宫格可以考虑用 display: grid
详细可以到 MDN 上找参考和文档
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-3-29 19:51

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表