Safari 在 table 个单元格周围添加边框,而不管边框折叠、填充:0 等
Safari adding border around table cells regardless of border-collapse, padding: 0 etc
尽管有多项设置可防止出现这种情况,Safari 仍会在 table 个单元格周围显示可见边框。我试图将 padding: 0 和 margin: 0 添加到所有,但问题似乎与填充无关。我已经在所有相关元素上尝试了各种边框设置来防止这种情况,但它仍然存在。这似乎只是 iPhones/Safari 上的一个问题。我已经在几个不同的 iPhone 设备上进行了测试(我是一个 android 的人,所以我能够在办公室里找到两个 iPhone 不同的人)并且他们每个人都显示不需要的边界。 Here is a screenshot of the issue.
这里是 html:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Oswald'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<style>
body {
background-color: #002D72;
font-family: 'OSWALD';
width: 100%;
max-width: 1280px;
height: 100%;
margin: 0 auto;
}
.mobile-wrap {
margin: 0 auto;
width: 100%;
}
.mobile-stations {
margin: 0 auto;
border-collapse: collapse;
border-spacing: 0;
}
.mobile-stations td {
color: GhostWhite;
width: 10vmax;
height: 10vmax;
font-size: min(1.6rem, 1.6vmax);
margin: 0 auto;
padding: 0 !important;
border: none;
background-color: red;
}
.mobile-stations td:nth-child(2) {
text-align: left;
width: auto !important;
}
.mobile-line-wrap {
position: relative;
height: 100%;
width: 100%;
margin: 0 auto;
}
.mobile-circle {
position: absolute;
background: GhostWhite;
border-radius: 50%;
width: 5vmax;
height: 5vmax;
margin: 0;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.mobile-circle2 {
position: absolute;
background: #002D72;
border-radius: 50%;
width: 4vmax;
height: 4vmax;
margin: 0;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.mobile-circle3 {
position: absolute;
background: GhostWhite;
border-radius: 50%;
width: 3vmax;
height: 3vmax;
margin: 0;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.mobile-circle4 {
position: absolute;
background: DarkRed;
border-radius: 50%;
width: 2vmax;
height: 2vmax;
margin: 0;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.mobile-line {
position: absolute;
width: .6vmax;
height: 100%;
background-color: GhostWhite;
margin-left: auto;
margin-right: auto;
text-align: center;
left: 0;
right: 0;
}
.mobile-line-top {
position: absolute;
width: .6vmax;
background-color: GhostWhite;
height: 50%;
margin-left: auto;
margin-right: auto;
text-align: center;
left: 0;
right: 0;
bottom: 0;
}
.mobile-line-bottom {
position: absolute;
width: .6vmax;
background-color: GhostWhite;
height: 50%;
margin-left: auto;
margin-right: auto;
text-align: center;
left: 0;
right: 0;
top: 0;
}
</style>
</head>
<body>
<div class="mobile-wrap">
<div class="mobile-locations">
<table class="mobile-stations">
<tr class="mobile-station-row">
<td><div class="mobile-line-wrap"><div class="mobile-line-top"></div><div class="mobile-circle"><div class="mobile-circle2"><div class="mobile-circle3"><div class="mobile-circle4"></div></div></div></div></div></td>
</tr>
<tr class="mobile-station-row">
<td><div class="mobile-line-wrap"><div class="mobile-line"></div><div class="mobile-circle"><div class="mobile-circle2"><div class="mobile-circle3"><div class="mobile-circle4"></div></div></div></div></div></td>
</tr>
<tr class="mobile-station-row">
<td><div class="mobile-line-wrap"><div class="mobile-line"></div><div class="mobile-circle"><div class="mobile-circle2"><div class="mobile-circle3"><div class="mobile-circle4"></div></div></div></div></div></td>
</tr>
<tr class="mobile-station-row">
<td><div class="mobile-line-wrap"><div class="mobile-line-bottom"></div><div class="mobile-circle"><div class="mobile-circle2"><div class="mobile-circle3"><div class="mobile-circle4"></div></div></div></div></div></td>
</tr>
</table>
</div>
</div>
</body>
</html>
矩形;图像失真是因为长度和宽度不相等。当前尺寸 (82x81)
.mobile-stations td {
color: GhostWhite;
width: 82px;
height: 82px;
font-size: min(1.6rem, 1.6vmax);
margin: 0 auto;
padding: 0 !important;
border: none;
background-color: red;
}
尽管有多项设置可防止出现这种情况,Safari 仍会在 table 个单元格周围显示可见边框。我试图将 padding: 0 和 margin: 0 添加到所有,但问题似乎与填充无关。我已经在所有相关元素上尝试了各种边框设置来防止这种情况,但它仍然存在。这似乎只是 iPhones/Safari 上的一个问题。我已经在几个不同的 iPhone 设备上进行了测试(我是一个 android 的人,所以我能够在办公室里找到两个 iPhone 不同的人)并且他们每个人都显示不需要的边界。 Here is a screenshot of the issue.
这里是 html:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Oswald'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<style>
body {
background-color: #002D72;
font-family: 'OSWALD';
width: 100%;
max-width: 1280px;
height: 100%;
margin: 0 auto;
}
.mobile-wrap {
margin: 0 auto;
width: 100%;
}
.mobile-stations {
margin: 0 auto;
border-collapse: collapse;
border-spacing: 0;
}
.mobile-stations td {
color: GhostWhite;
width: 10vmax;
height: 10vmax;
font-size: min(1.6rem, 1.6vmax);
margin: 0 auto;
padding: 0 !important;
border: none;
background-color: red;
}
.mobile-stations td:nth-child(2) {
text-align: left;
width: auto !important;
}
.mobile-line-wrap {
position: relative;
height: 100%;
width: 100%;
margin: 0 auto;
}
.mobile-circle {
position: absolute;
background: GhostWhite;
border-radius: 50%;
width: 5vmax;
height: 5vmax;
margin: 0;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.mobile-circle2 {
position: absolute;
background: #002D72;
border-radius: 50%;
width: 4vmax;
height: 4vmax;
margin: 0;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.mobile-circle3 {
position: absolute;
background: GhostWhite;
border-radius: 50%;
width: 3vmax;
height: 3vmax;
margin: 0;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.mobile-circle4 {
position: absolute;
background: DarkRed;
border-radius: 50%;
width: 2vmax;
height: 2vmax;
margin: 0;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.mobile-line {
position: absolute;
width: .6vmax;
height: 100%;
background-color: GhostWhite;
margin-left: auto;
margin-right: auto;
text-align: center;
left: 0;
right: 0;
}
.mobile-line-top {
position: absolute;
width: .6vmax;
background-color: GhostWhite;
height: 50%;
margin-left: auto;
margin-right: auto;
text-align: center;
left: 0;
right: 0;
bottom: 0;
}
.mobile-line-bottom {
position: absolute;
width: .6vmax;
background-color: GhostWhite;
height: 50%;
margin-left: auto;
margin-right: auto;
text-align: center;
left: 0;
right: 0;
top: 0;
}
</style>
</head>
<body>
<div class="mobile-wrap">
<div class="mobile-locations">
<table class="mobile-stations">
<tr class="mobile-station-row">
<td><div class="mobile-line-wrap"><div class="mobile-line-top"></div><div class="mobile-circle"><div class="mobile-circle2"><div class="mobile-circle3"><div class="mobile-circle4"></div></div></div></div></div></td>
</tr>
<tr class="mobile-station-row">
<td><div class="mobile-line-wrap"><div class="mobile-line"></div><div class="mobile-circle"><div class="mobile-circle2"><div class="mobile-circle3"><div class="mobile-circle4"></div></div></div></div></div></td>
</tr>
<tr class="mobile-station-row">
<td><div class="mobile-line-wrap"><div class="mobile-line"></div><div class="mobile-circle"><div class="mobile-circle2"><div class="mobile-circle3"><div class="mobile-circle4"></div></div></div></div></div></td>
</tr>
<tr class="mobile-station-row">
<td><div class="mobile-line-wrap"><div class="mobile-line-bottom"></div><div class="mobile-circle"><div class="mobile-circle2"><div class="mobile-circle3"><div class="mobile-circle4"></div></div></div></div></div></td>
</tr>
</table>
</div>
</div>
</body>
</html>
矩形;图像失真是因为长度和宽度不相等。当前尺寸 (82x81)
.mobile-stations td {
color: GhostWhite;
width: 82px;
height: 82px;
font-size: min(1.6rem, 1.6vmax);
margin: 0 auto;
padding: 0 !important;
border: none;
background-color: red;
}