当前位置:网站首页>搜索框和按钮缩放时会有缝隙的bug
搜索框和按钮缩放时会有缝隙的bug
2022-07-01 15:42:00 【崽崽的谷雨】
问题描述:
做一个类似于 百度的搜索框时,浏览器 100% 没什么问题,但是缩放到175% 时按钮和input会出现缝隙。
100%效果图
175%效果图
如上图:明显能看出 有空白的缝隙
产生这个的原因是:当缩放到175%时,应该1.75格代表1像素,但由于硬件层次限制,比如一格用四个物理像素点绘制,0.25格就不绘制,故1.75格中的0.75,只能用三格绘制,未绘制的一格产生了空隙(css 页面缩放边框产生空隙相关)
如果是 按钮和 input 之间有缝隙 且对不齐 可以参考:input输入框和button确定按钮之间的默认间距问题
代码如下:
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div class="search">
<input type="search" name="" id="" placeholder="搜索" />
<button>搜索</button>
</div>
<style type="text/css">
.search {
position: absolute;
top: 25px;
left: 346px;
width: 534px;
height: 32px;
border: 2px solid #b1191a;
}
.search input {
float: left;
padding-left: 10px;
width: 454px;
height: 32px;
vertical-align: middle;
border: none;
outline: none;
}
.search button {
float: left;
width: 80px;
height: 32px;
background-color: #b1191a;
color: #f8f7f7;
border: none;
}
</style>
</body>
</html>
解决方案:
1.可以给 button 加一个 outline:1px solid xxx ;
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div class="search">
<input type="search" name="" id="" placeholder="搜索" />
<button>搜索</button>
</div>
<style type="text/css">
.search {
position: absolute;
top: 25px;
left: 346px;
width: 534px;
height: 32px;
border: 2px solid #b1191a;
}
.search input {
float: left;
padding-left: 10px;
width: 454px;
height: 32px;
vertical-align: middle;
border: none;
outline: none;
}
.search button {
float: left;
width: 80px;
height: 32px;
background-color: #b1191a;
color: #f8f7f7;
border: none;
outline: solid 1px #b1191a;
}
</style>
</body>
</html>
100%效果图:
175%效果图
边栏推荐
- 硬件开发笔记(九): 硬件开发基本流程,制作一个USB转RS232的模块(八):创建asm1117-3.3V封装库并关联原理图元器件
- TensorFlow团队:我们没被抛弃
- Survey of intrusion detection systems:techniques, datasets and challenges
- An intrusion detection model
- Research on manually triggering automatic decision of SAP CRM organization model with ABAP code
- 二叉树的前序,中序,后续(非递归版本)
- 重回榜首的大众,ID依然乏力
- Stm32f411 SPI2 output error, pb15 has no pulse debugging record [finally, pb15 and pb14 were found to be short circuited]
- Create employee data in SAP s/4hana by importing CSV
- 新出生的机器狗,打滚1小时后自己掌握走路,吴恩达开山大弟子最新成果
猜你喜欢
STM32ADC模拟/数字转换详解
[pyGame practice] do you think it's magical? Pac Man + cutting fruit combine to create a new game you haven't played! (source code attached)
异常检测中的浅层模型与深度学习模型综述(A Unifying Review of Deep and Shallow Anomaly Detection)
Wechat applet 01 bottom navigation bar settings
One revolution, two forces, three links: the "carbon reduction" roadmap behind the industrial energy efficiency improvement action plan
求求你们,别再刷 Star 了!这跟“爱国”没关系!
Go语学习笔记 - gorm使用 - 表增删改查 | Web框架Gin(八)
[target tracking] | template update time context information (updatenet) "learning the model update for Siamese trackers"
【STM32-USB-MSC问题求助】STM32F411CEU6 (WeAct)+w25q64+USB-MSC Flash用SPI2 读出容量只有520KB
Tanabata confession introduction: teach you to use your own profession to say love words, the success rate is 100%, I can only help you here ~ (programmer Series)
随机推荐
《QT+PCL第六章》点云配准icp系列2
自動、智能、可視!深信服SSLO方案背後的八大設計
For the sustainable development of software testing, we must learn to knock code?
Returning to the top of the list, the ID is still weak
二叉树的前序,中序,后续(非递归版本)
ATSS:自动选择样本,消除Anchor based和Anchor free物体检测方法之间的差别
Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
Wechat applet 02 - Implementation of rotation map and picture click jump
ThinkPHP进阶
STM32ADC模拟/数字转换详解
【Pygame实战】你说神奇不神奇?吃豆人+切水果结合出一款你没玩过的新游戏!(附源码)
Redis high availability principle
Qt+pcl Chapter 6 point cloud registration ICP series 3
重回榜首的大众,ID依然乏力
Advanced cross platform application development (24): uni app realizes file download and saving
Qt+pcl Chapter 6 point cloud registration ICP series 4
做空蔚来的灰熊,以“碰瓷”中概股为生?
并发编程系列之什么是ForkJoin框架?
Pocket Network为Moonbeam和Moonriver RPC层提供支持
大龄测试/开发程序员该何去何从?是否会被时代抛弃?