简体   繁体   English

CSS Html:Chrome上选定文本区域的圆角

[英]CSS Html: Rounded corners for selected textarea on Chrome

I'm trying to add a textarea with rounded corners to my site. 我正在尝试为我的网站添加带圆角的textarea。

I'm using this css: 我正在使用这个CSS:

-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;

Right now this shows correctly in chrome, however when the textarea gets the focus, an orange border is added to the textarea and such border doesn't have rounded corners. 现在这在chrome中正确显示,但是当textarea获得焦点时,橙色边框被添加到textarea并且这样的边框没有圆角。

Any idea on how to fix this? 有关如何解决此问题的任何想法?

Thanks 谢谢

To remove the default outline , and then emulate that outline with one that's more...style-compliant: 要删除默认outline ,然后使用更符合样式的大纲来模拟该大纲:

textarea {
    width: 40%;
    height: 10em;
    border-radius: 1em;
    border: 1px solid #000; /* everything up to and including this line
                               are aesthetics, adjust to taste */
    outline: none; /* removes the default outline */
    resize: none; /* prevents the user-resizing, adjust to taste */
}

textarea:focus {
    box-shadow: inset 0 0 3px 2px #f90; /* provides a more style-able
                                           replacement to the outline */
}​

JS Fiddle demo . JS小提琴演示

textarea:focus{outline:none}应该这样做,虽然没有看到它很难回答

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM