我正在尝试使用电子邮件中的CSS边框生成一个三角形,并在其中放置一些动态文本(数字),但是我想将其设置为三角形的中心,并且我无法使用定位,因为它已从内联CSS
我尝试将三角形css的div和文本范围放在div容器中,并使用位置对齐-没用
Payload size: 0x100fffe (0xffffff + 0xffff)
MySQL Packets:
#1: length of payload = ff ff ff (size = 0x1000003)
#2: length of payload = ff ff 00 (size = 0x10003)
Compressed packets:
MySQL Packet #1:
#1: length of payload before compression = ff ff ff
#2: length of payload before compression = 04 00 00
MySQL Packet #2:
#1: length of payload before compression = ff ff 00
尝试使用此技巧
<div style="<%= MailComponents.create_style('display' => 'inline-block', 'width' => '2px', 'height' => '0px', 'border-radius' => '4px' ,'border-left' => '20px solid transparent', 'border-right' => '20px solid transparent' ,'border-bottom => '30px solid #FC577A', 'color' => '#fff', 'vertical-align' => 'middle', 'line-height' => '28px', 'margin-top' => '-10px') %>">
<span style="<%= MailComponents.create_style('position' => 'relative', 'left' => '-8px','vertical-align' => 'middle', ) %>">
<%= some dynamically generated number %>
</span>
</div>
没有帮助 我想知道是否可以使用表
答案 0 :(得分:1)
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
display: grid;
grid-template-columns: auto;
justify-content: center;
align-items: center;
}
.wrapper {
background: #000;
width: 200px;
height: 200px;
-webkit-clip-path: polygon(0% 87%, 50% 0%, 50% 0%, 100% 87%);
clip-path: polygon(0% 87%, 50% 0%, 50% 0%, 100% 87%);
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="container">
<div class="wrapper">
</div>
</div>
</body>
</html>
在父类上使用 display:grid ,并 justify-content:center; 将其水平居中对齐!作为参考,您可以在https://docs.julialang.org/en/v1/stdlib/Mmap上查看此链接。希望对您有帮助