我有一个放大器站点,并注意到在将amp-selector与option ='something'一起使用时,“单选按钮”的大小取决于内容的长度。
我使用了AMP示例中的CSS。
有人可以将单选按钮的大小保持相同吗? 看到这里
https://codepen.io/iamalta/pen/OEEPRq
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<title>amp-selector</title>
<link rel="canonical" href="<%host%>">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<!-- ## Setup -->
<!--
Import the amp-selector component.
-->
<script async custom-element="amp-selector" src="https://cdn.ampproject.org/v0/amp-selector-0.1.js"></script>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<style amp-custom>
amp-selector, button {
margin: 1rem;
}
amp-selector:not([disabled]) amp-img[option][selected]:not([disabled]) {
outline-color: #b60845;
outline-width: 2px;
}
/* disables build-in browser highlights */
amp-selector *:focus {
outline: none;
}
amp-selector[disabled],
amp-selector [disabled] {
opacity: 0.5;
}
.divider {
border-right: 2px solid #333;
height: 40px;
}
amp-selector.radio-selector {
list-style: none;
}
amp-selector.radio-selector [option][selected] {
outline: none;
}
amp-selector.radio-selector [option] {
display: flex;
align-items: center;
}
amp-selector.radio-selector [option]:before {
transition: background 0.25s ease-in-out;
content: "";
display: inline-block;
width: 24px;
height: 24px;
margin: 8px;
border-radius: 100%;
border: solid 1px black;
}
amp-selector.radio-selector [option][selected]:before {
text-align: center;
content: "✓";
color: white;
background: black;
}
</style>
</head>
<body>
<!-- ## Forms -->
<!--
Inside a form, `amp-selector` behaves like a radio-button/checkbox group and submits the selected value(s) against the name of the amp-selector. Here we've styled an amp-selector to function like a radio list. Using `amp-selector` for this has the advantage that bindings using [`amp-bind`](/components/amp-bind/) are easier to implement.
-->
<form action="#" method="get" target="_top">
<amp-selector class="radio-selector" layout="container" name="my-selector">
<div option="a">Option A </div>
<div option="b">Option B Option B Option B Option B Option B Option B Option B Option B Option B Option B Option B Option B Option B Option B Option B Option B Option B Option B </div>
<div option="c">Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C Option C </div>
</amp-selector>
<input type="submit"
value="Select"
class="ampstart-btn ampstart-btn-secondary caps m1">
</form>
</body>
</html>