Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style a div to be like a rocket?

Tags:

html

css

I want to style an html div to be like a rocket, I mean it should represented as an oblong with a triangle edge. Just like this screenshot:-

enter image description here

like image 907
Azzurrio Avatar asked Sep 09 '12 23:09

Azzurrio


People also ask

How do I curve a div in CSS?

CSS Based Approaches:Create a layer with ::before OR ::after pseudo element having width and height more than its parent. Add border-radius to create the rounded shape. Add overflow: hidden on parent to hide the unnecessary part.

How do you put two elements on top of each other in CSS?

Using CSS position property: The position: absolute; property is used to position any element at the absolute position and this property can be used to stack elements on top of each other. Using this, any element can be positioned anywhere regardless of the position of other elements.

How do you stack a div on top of each other?

You can use the CSS position property in combination with the z-index property to overlay an individual div over another div element. The z-index property determines the stacking order for positioned elements (i.e. elements whose position value is one of absolute , fixed , or relative ).

Why border-radius is not working?

If there are contents within the div that has the curved corners, you have to set overflow: hidden because otherwise the child div's overflow can give the impression that the border-radius isn't working. This answer worked for me.


1 Answers

A pure CSS solution could make use of the :after pseudoselector and abusing borders to make triangles. This site will even generate the code for you:

http://cssarrowplease.com/

Set the position to right and the size to be the height of the div.

like image 72
davidscolgan Avatar answered Oct 16 '22 14:10

davidscolgan