insanus Asked:2022-07-30 04:36:04 +0000 UTC2022-07-30 04:36:04 +0000 UTC 2022-07-30 04:36:04 +0000 UTC 如何为输入制作非标准帧? 772 有这样一个输入,我不明白怎么可能让它通过边界,但是边缘变得很锋利 border-bottom-width: 2px border-bottom-color: $black border-bottom-style: solid box-sizing: border-box border-bottom-left-radius: 8px border-bottom-right-radius: 8px 如果你通过渐变来做,那么笔画就会被切断。 我能做到的唯一方法是添加第二个元素,是否可以在不创建额外块的情况下制作它 css 3 个回答 Voted Qwertiy 2022-07-30T06:06:07Z2022-07-30T06:06:07Z input { border: 2px solid black; border-top-color: transparent; border-radius: 8px; padding: 4px 8px; font-family: monospace; } span { display: inline-block; position: relative; } span::before, span::after { content: ""; position: absolute; top: 0; bottom: 8px; width: 8px; background: white; pointer-events: none; } span::before { left: 0; } span::after { right: 0; } span:focus-within::before, span:focus-within::after { content: none; } input:focus { border-color: black; outline: none; } <span><input value="It's an input"></span> Anonimus stupid man 2022-07-30T17:41:22Z2022-07-30T17:41:22Z y 的锐边border由 CSS 属性更改border-radius: __ 要像在屏幕上那样做,你需要设置它outline,就像边框一样,或者做 input { outline: none; } input:focus { outline: none; } 之后,该物业border将开始工作。例如这里: input { outline: none; border: none; border-bottom: 2px solid black; border-radius: 5px; } <input type="text" placeholder="Ваше имя"></input> Best Answer Qwertiy 2022-07-30T20:08:38Z2022-07-30T20:08:38Z input { border: 2px solid black; border-radius: 8px; padding: 4px 8px; font-family: monospace; background: transparent; clip-path: polygon( 8px 8px, calc(100% - 8px) 8px, calc(100% - 8px) calc(100% - 8px), 100% calc(100% - 8px), 100% 100%, 0 100%, 0 calc(100% - 8px), 8px calc(100% - 8px) ); } input:focus { clip-path: none; outline: none; } body { background: linear-gradient(to bottom, white, orange); } <input value="It's an input">
y 的锐边
border由 CSS 属性更改border-radius: __要像在屏幕上那样做,你需要设置它
outline,就像边框一样,或者做之后,该物业
border将开始工作。例如这里: