Jump to content

Triangle after a box


george

Recommended Posts

I am trying to create a triangle at the right end of a box. My HTML is

<div class="exampOne"></div>

and my CSS

.exampOne { background-color:green; width:30px; height:20px; }.exampOne:after {	border-color: transparent transparent transparent blue;	border-style:solid;border-width:20px;height:0px;width:0px;z-index: 3;}

What am I doing wrong?Thanks

Link to comment
Share on other sites

:after does nothing unless you give it some content -- even if it's empty. For this application, you need to change the display property also. So add these two lines:

content:"";display:inline-block;

Edited by Deirdre's Dad
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...