简体   繁体   English

我如何使div即使具有border-radius设置也能获得正方形边框

[英]How can I make div to get square border even though it has border-radius setting

Now I am working on HTML page. 现在,我正在处理HTML页面。

And I made div with 'border-radius: 150px', so this div has radius border. 我使用“ border-radius:150px”制作了div,因此该div具有半径边框。

But I need to give this div square border. 但是我需要给这个div方形边框。 Of course not only exact border, maybe similar thing like border is ok. 当然,不仅精确的边界,而且边界之类的类似东西也可以。

But I don't know how can I do this. 但是我不知道该怎么办。 Please let me know. 请告诉我。

Thank you. 谢谢。

EDIT 编辑

Now I found that outline is not same working for Chrome and Firefox. 现在,我发现大纲不适用于Chrome和Firefox。 In Chrome outline is only for itself area, but in Firefox outline is for area including it's children dom nodes. 在Chrome中,轮廓仅适用于自身区域,而在Firefox中,轮廓仅适用于包括其子dom节点的区域。 Now I want to make Firefox as same as Chrome's outline action. 现在,我要使Firefox与Chrome的概述动作相同。 How can I do this in Firefox. 如何在Firefox中执行此操作。

Hope this is what you are looking for. 希望这是您想要的。

:) :)

 div { background: red; width: 300px; height: 300px; border-radius: 150px; outline: 5px solid green; } 
 <div></div> 

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

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