Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>

that produce:

haflcircle

in firefox,

but in chrome (linux, and windows - didnt try in mac) i see nothing why?

like image 462
rcs20 Avatar asked Feb 20 '12 15:02

rcs20


2 Answers

I believe it is some sort of bug, actually. It works for me if you change the height and width to 1px. This leaves a little white dot, unfortunately, but that can be fixed by changing the background to red and the background-clip to content.

JSFiddle example.

like image 69
Nate B Avatar answered Sep 30 '22 11:09

Nate B


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

width: 0px;
height: 0px;

Change this, hope it'll be visible.

like image 39
The Alpha Avatar answered Sep 30 '22 12:09

The Alpha