Skip to content Skip to sidebar Skip to footer

How Can I Create Div With A Pointed Top With Css

I've see a lot of threads remotely related that basically suggest CSS triangles in the ::after or ::before pseudos, but none have really panned out. I'm throwing this out to see i

Solution 1:

If you dont want to use a image you could do something like this. But working with an image is lot easier in this case.

body {
    background-color: #CCC;
}

.wrapper {
    
}

.outer {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0205px32px205px;
    border-color: transparent transparent #ffffff transparent;
    position: absolute;
}

.inner {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0200px32px200px;
    border-color: transparent transparent #ea2225 transparent;
    margin-left: -200px;
    margin-top: 5px;
    position: absolute;
}

.fix {
    background-color: #FFF;
    height: 10px;
    width: 410px;
    position: absolute;
    margin-top: 32px;
}

.red {
    width: 396px;
    height: 300px;
    background-color: #ea2225;
    margin-top: 37px;
    position: absolute;
    border-left: 7px solid #FFF;
    border-right: 7px solid #FFF;
    border-bottom: 6px solid #FFF;
-webkit-box-shadow: 3px5px5px0pxrgba(48,48,48,1);
-moz-box-shadow: 3px5px5px0pxrgba(48,48,48,1);
box-shadow: 3px5px5px0pxrgba(48,48,48,1);
}
<divclass="wrapper"><divclass="fix"></div><divclass="outer"><divclass="inner"></div></div></div><divclass="red"></div>

See http://jsfiddle.net/0csqog8s/

Solution 2:

this should get you started:

Update

This is an updated fiddle which is much better presented.

.first {
  display: inline-block;
  width: 3em;
  height: 3em
}
.second {
  position: relative;
  display: inline-block;
  width: 3em;
  height: 3em
}
.third {
  position: absolute;
  display: inline-block;
  width: 0;
  height: 0;
  line-height: 0;
  border: 1.5em solid transparent;
  margin-top: -1em;
  border-bottom: 1em solid #007BFF;
  left: 0em;
  top: 0em
}
.forth {
  position: absolute;
  display: inline-block;
  width: 0;
  height: 0;
  line-height: 0;
  border: 1.5em solid #007BFF;
  border-bottom: 1.5em solid #007BFF;
  left: 0em;
  top: 1.5em
}
<spanclass="first"><spanclass="second"><iclass="third"></i><iclass="forth"></i></span></span>

Post a Comment for "How Can I Create Div With A Pointed Top With Css"