写了margin:0;paddind:0;也会有边距

元素和元素之间有一定边距

有时候我们在编程是将margin改成0,padding也改成0但无论如何都会有一定的边距,如下图:
在这里插入图片描述
有时候真的很令人头疼,怎么找也找不出原因;
解决办法:在元素与另一个元素换行的位置打一个注释就行了
因为换行会默认有一定的边距
在这里插入图片描述
这样就解决啦!
在这里插入图片描述

  • 6
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
好的,以下是一个简单的自适应登录和注册页面的示例代码: ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Login/Register Page</title> <style> body { font-family: Arial, sans-serif; } .container { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; height: 100vh; background-color: #f2f2f2; } form { background-color: #fff; border-radius: 5px; padding: 20px; box-shadow: 0px 0px 10px rgba(0,0,0,0.1); margin: 10px; width: 100%; max-width: 350px; } input[type="text"], input[type="password"], input[type="email"] { width: 100%; padding: 10px; margin: 5px 0; border: none; border-radius: 3px; box-shadow: 0px 0px 5px rgba(0,0,0,0.1); } input[type="submit"] { width: 100%; padding: 10px; margin: 5px 0; border: none; border-radius: 3px; background-color: #4CAF50; color: #fff; font-weight: bold; cursor: pointer; } input[type="submit"]:hover { background-color: #3E8E41; } @media screen and (min-width: 768px) { .container { flex-direction: row; } form { margin: 0 10px; width: auto; max-width: none; } } </style> </head> <body> <div class="container"> <form action="#" method="post"> <h2>Login</h2> <label for="username">Username:</label> <input type="text" id="username" name="username" required> <label for="password">Password:</label> <input type="password" id="password" name="password" required> <input type="submit" value="Login"> </form> <form action="#" method="post"> <h2>Register</h2> <label for="username">Username:</label> <input type="text" id="username" name="username" required> <label for="email">Email:</label> <input type="email" id="email" name="email" required> <label for="password">Password:</label> <input type="password" id="password" name="password" required> <input type="submit" value="Register"> </form> </div> </body> </html> ``` 这个页面使用了 Flexbox 布局来自适应不同的屏幕大小,通过媒体查询在大屏幕上显示两个表单。每个表单都有一个标题,用于标识该表单是登录还是注册。表单中包含了必要的输入字段和提交按钮。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值