div { margin: 100px auto; width: 0px; height: 0px; bord...">

Css does not work in chrome (linux and windows)

I have this code:

<style type="text/css"> div { margin: 100px auto; width: 0px; height: 0px; border-right: 30px solid transparent; border-top: 30px solid red; border-left: 30px solid red; border-bottom: 30px solid transparent; border-top-left-radius: 30px; border-top-right-radius: 30px; border-bottom-left-radius: 30px; border-bottom-right-radius: 30px; position: relative; } </style> <div></div> 

which produce:

haflcircle

in firefox,

but in chrome (linux and windows - did not try on mac) I don’t see anything why?

+6
source share
2 answers

I think this is some kind of mistake. It works for me if you change the height and width by 1px. Unfortunately, this leaves a small white dot, but this can be eliminated by changing the background to red and the background clip to content.

JSFiddle example.

+15
source

Because you gave 0px the width and height 0px for the div, so you see nothing.

 width: 0px; height: 0px; 

Change it, hope it will be visible.

+1
source

Source: https://habr.com/ru/post/908900/


All Articles