Bevel Corner Colour to same as box? - html

Can anyone solve this issue?
I've created some bevelled edge corners to a box using a before and after tag. This works great if I style the colour of the box and the before and after with the specified colour.
However I need to be able to swap colours easily using colour classes in the html. But I can't get the colour classes to change the before and after state.
Its tricky to explain but please see the codepen mock up and you will easily see the problem.
I basically want to change the whole thing to either red,green,blue etc using one class and not have to change the before and after colours as well.
https://codepen.io/Hornet_ant/pen/zZZWMp
HTML:
<div class="bc-box bc-red">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pretium
</p>
</div>
CSS
.bc-box {
position: relative;
margin: 40px 0 40px 0;
padding: 0 20px;
}
.bc-box:before, .bc-box:after {
box-sizing: border-box;
border-style: solid;
border-color: transparent;
border-width: 20px;
content: "";
display: block;
left: 0;
position: absolute;
width: 100%;
}
.bc-box:before {
border-top-width: 0;
top: -20px;
border-bottom-color: #f5862d;
}
.bc-box:after {
border-bottom-width: 0;
bottom: -20px;
border-top-color: #f5862d;
}
/* <---COLOURS----> */
.bc-green{
background-color: #30a79c;
}
.bc-red {
background-color: #dd004c;
}
.bc-blue{
background-color:#5276b6;
}
I'd be grateful if anyone can take a look at this and see if there is a solution.
Thanks
Anthony

Consider this option, using three elements (top, middle,bottom) and playing with borders you can have a quite good result avoiding pseudo-elements. Then you just set a border-color in each color-class. One caveat is that you'll have to absolute position the content inside the middle element. DEMO
.text {
position: absolute;
top: -65px;
}
.trapezoid {
height: 0;
width: 500px;
border-style: solid;
}
.trapezoid:nth-child(1) {
border-bottom-width: 50px;
border-top-width: 0px;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
.middle {
height: 0;
width: 500px;
border-style: solid;
border-width: 50px;
position: relative;
}
.trapezoid:nth-child(3) {
border-top-width: 50px;
border-bottom-width: 0px;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
.bc-red div {
border-color: red;
}
.bc-green div {
border-color: green;
}
<div class="bc-green"><!--Just change this class and all colors change-->
<div class="trapezoid"></div>
<div class="middle">
<div class="text">
<h3>Heading three</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pretium nisi vitae mauris egestas aliquam. Sed sed nulla ipsum. Donec id eleifend mauris. Morbi ultricies, est sit amet porttitor condimentum, sem ligula</p>
</div>
</div>
<div class="trapezoid"></div>
</div>

Please see the CSS solution below. I added before and after selectors to the bc-green colour class;
.bc-green::after {
border-top-color: green; !important
}
.bc-green::before {
border-bottom-color: green; !important
}
.bc-green{
background: green;
}
See the working solution over at Codepen > http://codepen.io/jabuttercup123/pen/Pppdab

Related

How to draw curved div stacked on top of one another?

I am working on web application using Rect JS and I only have beginners knowledge in HTML and CSS.So can you please suggest me to achieve something like the following with a responsive UI that containing button,text and image.How can I write css styles to curve a div and place another one below it without any blank space.
Can someone please suggest any solution? Any help would be really appreciated.I have tried radial-gradient method like following.
<div className="background1">
....
</div>
<div className="background2">
.....
</div>
.background1 {
width: 100%;
background: radial-gradient(120% 800px at 50% -30px, red 75%,
transparent 75%) no-repeat;
z-index: 2;
position:relative;
margin-bottom: 0px;
}
.background2 {
background-color: #202492;
width: 100%;
background: radial-gradient(120% 800px at 50% -30px,blue 75%,
transparent 75%) no-repeat;
position: relative;
z-index: 1;
margin-top: -50px;
}
But I am getting this
Blockquote
I think you need something like this:
.btn1 {
background: #190b0b;
color: #fff;
padding: 1em 2.5em;
box-shadow: 1px 2px 7px -1px #190b0b;
}
.background1 {
width: 100%;
background: red;
z-index: 2;
position: relative;
margin-bottom: 0px;
padding: 6em 0;
border-radius: 0 0 10em 10em;
text-align: center;
}
.background2 {
background-color: #202492;
z-index: 1;
position: relative;
margin-bottom: 0px;
padding: 6em 0;
border-radius: 0 0 10em 10em;
text-align: left;
width: 100%;
top: -10em;
color: #fff;
}
.background3 {
background-color: blue;
z-index: 0;
position: relative;
margin-bottom: 0px;
padding: 6em 0;
border-radius: 0 0 10em 10em;
text-align: left;
width: 100%;
top: -20em;
color: #fff;
}
.text {
margin-top: 6em;
max-width: 50%;
padding: 0 6em;
}
<div class="background1">
<button class="btn1">Button</button>
</div>
<div class="background2">
<div class="text">
<h2> Text1 </h2>
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse pellentesque, nibh sed tempus bibendum, lacus turpis dictum ipsum, nec consectetur diam nisi eget mauris. </p>
</div>
</div>
<div class="background3">
<div class="text">
<h2> Text2 </h2>
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse pellentesque, nibh sed tempus bibendum, lacus turpis dictum ipsum, nec consectetur diam nisi eget mauris. </p>
</div>
</div>
Just change in border-radius and padding values to have the perfect curve that you want.
You can use border-bottom-left-radius and border-bottom-lright-radius or border-radius: 0px 0px xxxpx xxpx;
div {
height: 300px;
width: 300px;
border-bottom-right-radius: 200px;
border-bottom-left-radius: 200px;
background: black;
}
<div></div>

Floating divs inside inline-block parent goes down on resize

I have 2 floating divs, inner-left and inner-right inside parent container inner-container.
inner-container is set to display: inline-block; to have it's width to be equal of width of it's children.
The problem is, when I resize the window, inner-right div goes down and only then starts to resize itself.
How do I inner-right make it stay on the same line with inner-left, and, in the event of window resize, to resize instead of going down?
HTML:
<div class="container">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<div class="inner-container">
<div class="inner-left"><img src="http://placehold.it/100x100" alt=""></div>
<div class="inner-right"><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In justo orci, rutrum nec feugiat sed, ultrices non dolor. Aliquam laoreet.</strong><br>
Vivamus purus metus.
</div>
</div>
</div>
CSS:
.container {
background-color: #f0fff0;
padding: 10px;
border: 1px solid #bce2c1;
border-radius: 5px;
}
.inner-container {
padding: 10px;
background-color: #ffffff;
border: 1px solid #bce2c1;
border-radius: 5px;
margin-top: 10px;
display: inline-block;
}
.inner-left {
float:left;
width: 60px;
}
.inner-left img {
height: 60px;
width: 60px;
}
.inner-right {
float:right;
text-align: left;
padding-left: 10px;
}
JSFIDDLE:
https://jsfiddle.net/acidonyx/naw6ojwe/4/
well just remove float: right from .inner-right and your problem will be solved.
.inner-right {
text-align: left;
padding-left: 10px;
}
to solve your other problem you can do
.inner-right {
overflow: hidden;
text-align: left;
padding-left: 10px;
}
For this you should use flexbox, here with inline-flex to fit your requirement
.container {
display: inline-block;
background-color: #f0fff0;
padding: 10px;
border: 1px solid #bce2c1;
border-radius: 5px;
}
.inner-container {
display: inline-flex;
padding: 10px;
background-color: #ffffff;
border: 1px solid #bce2c1;
border-radius: 5px;
margin-top: 10px;
}
.inner-left img {
height: 60px;
width: 60px;
}
.inner-right {
padding-left: 10px;
}
<div class="container">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<div class="wrap-container">
<div class="inner-container">
<div class="inner-left">
<img src="http://placehold.it/100x100" alt="">
</div>
<div class="inner-right"><strong>Lorem ipsum dolor sit</strong>
<br>Vivamus purus metus.
</div>
</div>
</div>
</div>
You could try floating .inner-right to the left instead, and giving it a width set in a percentage value, like this:
.inner-right {
float:left;
width: 85%;
}
JSFIDDLE
You can use media queries to update the percentage as you need.

Z-index for image and div [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am looking for a way to allow an image inside of a div to stay overflow:visible and to allow the border of the parent div to overlap the image. Right now I have the image right where I want it using negative margins, but the images is covering the parent div's border.
I tried using z-index for the image and the div but that did now work.
This is the effect that I am trying to achieve.
http://imgur.com/a/yt8eU
This where I currently am.
http://imgur.com/a/sgYjI
https://jsfiddle.net/zgwywq0v/
random html <p>
Position the image absolutely or relatively and set it z-index: -1.
div.keynote {
border: 3px solid #F68B1F;
position: relative;
}
div.keynote img {
position: absolute;
left: -20px;
top: -20px;
z-index: -1;
}
https://jsfiddle.net/zgwywq0v/3/
The main trick here is to use the pseudo element ::before for the border, and to align them left/right I gave their parent keynote display: flex
Note, an obvious way would be using z-index, though if one can do it without, do it without
div.keynote {
position: relative;
display: flex;
}
div.keynote::before {
content: '';
position: absolute;
border: 3px solid #F68B1F;
left: 20px;
top: 20px;
right: 20px;
bottom: 20px;
}
div.keynote .speaker-info {
position: relative;
padding: 30px 30px 30px 10px;
box-sizing: border-box;
}
<div class="keynote keynote-border">
<div>
<img src="http://placehold.it/240x320">
</div>
<div class="speaker-info">
<p class="name">PASTOR
<br><strong>PATRICK</strong>WINFIELD</p>
<p class="session">PREPARING FOR TOMORROW</p>
<p class="description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut molestie rutrum ipsum, luctus interdum metus egestas non. Aliquam at mi sollicitudin leo blandit ornare. Suspendisse laoreet ultrices ante. Nunc a velit elementum, pretium erat ut, vulputate
ante. Maecenas ac magna augue. Donec ac mauris lectus.</p>
</div>
</div>
Updated based on comment
If you can't/don't want to use flex, here is a fallback
div.keynote {
position: relative;
overflow: auto; /* clear float and grow with its content */
}
div.keynote::before {
content: '';
position: absolute;
border: 3px solid #F68B1F;
left: 20px;
top: 20px;
right: 20px;
bottom: 20px;
}
div.keynote div:first-child {
float: left;
width: 240px;
}
div.keynote .speaker-info {
position: relative;
margin-left: 240px; /* left div width */
padding: 30px 30px 30px 10px;
box-sizing: border-box;
}
<div class="keynote keynote-border">
<div>
<img src="http://placehold.it/240x320">
</div>
<div class="speaker-info">
<p class="name">PASTOR
<br><strong>PATRICK</strong>WINFIELD</p>
<p class="session">PREPARING FOR TOMORROW</p>
<p class="description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut molestie rutrum ipsum, luctus interdum metus egestas non. Aliquam at mi sollicitudin leo blandit ornare. Suspendisse laoreet ultrices ante. Nunc a velit elementum, pretium erat ut, vulputate
ante. Maecenas ac magna augue. Donec ac mauris lectus.</p>
</div>
</div>
Take the image out of the div and place bordered div and img inside a parent with position: relative; then you can change the position and z-index of bordered div and img to get your result.
This looks like the perfect opportunity to deploy an ::after pseudo-element - this will enable you to make the orange border exactly the dimensions you need it to be and position it exactly where you want it to be, completely independently of all the other elements.
.profile-card {
margin: 100px 0 0 100px;
width: 600px;
height: 300px;
font-family: arial, helvetica, sans-serif;
}
.profile-card::after {
content: '';
position: absolute;
top: 70px;
left: 70px;
z-index: 0;
display: block;
width: 600px;
height: 220px;
border: 3px solid rgb(255,165,0);
}
.profile-card h2 {
font-weight: 300;
}
.profile-card h2 b {
font-weight: 900;
}
.profile-card p,
.profile-card a.more {
font-size: 11px;
}
.profile-card h2,
.profile-card h2 ~ strong,
.profile-card a.more {
text-transform: uppercase;
}
.profile-card img {
display: block;
float: right;
width: 280px;
height: 280px;
background-color: rgb(191,191,191);
border: 1px solid rgb(0,0,0);
transform: translateY(-108px);
}
.profile-card a.more {
display: inline-block;
position: relative;
z-index: 6;
margin-left: 90px;
padding: 12px;
color: rgb(255,255,255);
background-color: rgb(255,165,0);
text-decoration: none;
}
<div class="profile-card">
<h2><b>Profile</b> Name</h2>
<img src="/profile-name.png" alt="Profile Photo" />
<strong>Profile Tagline Here</strong>
<p>Paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here.</p>
<a class="more" href="/more.html">Read More</a>
</div>

Button's hover works wrong, top margin

i made two buttons, with border: 2px solid #color, after I hover on them, the border vanishes and the button goes 2px down. I just made :hover margin2 px more than the normal one. Everything is okay, but the only problem is that when I hover one of my buttons, both goes these 2px down. What's wrong?
Cheers.
This is my html code:
<div class="slide-wrapper">
<h2>We are <span>cool</span> kids</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut porta, nulla sit amet rutrum finibus, ligula orci.</p>
Videos
Sign for a newsletter
</div>
And this is my css:
.btn {
padding: 16px 38px;
margin-right: 30px;
border-radius: 5px;
display: inline-block;*/
}
.btn:last-child {
margin-right: 0;
}
.btn-show {
background: #4183d7;
box-shadow: 0 2px #446cb3;
}
.btn-sign {
background-color: #87d37c;
box-shadow: 0 2px #7ebc74;
}
.btn-show:hover,
.btn-sign:hover,
.btn-newsletter:hover {
margin-top: 2px;
box-shadow: none;
}
The issue is display: inline-block defaults to the baseline. So when you push one button down 2px's the other one is going by default (since there is 2 more pixels of space). Set the vertical alignment to default to top:
.btn {
padding: 16px 38px;
margin-right: 30px;
border-radius: 5px;
display: inline-block;
vertical-align: top; //add
}
FIDDLE

How to make diamond shape in html div using css3 without using background image...?

I am making html of above image, I already tried several different ways using css3, html5 to implement this, but I think it is impossible without using background images.
Source: http://ashteldemo.com/1231231.jpg
Can anyone suggest something about implementing this without background images?
I created an example using only HTML and CSS and it is a little bit close to the image version, but i think isn't practical to build this with only HTML and CSS. Check out.
HTML
<div class="container">
<div class="top">
<div class="diamond-one">
<h3>Title</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.</p>
</div>
<div class="diamond-inverted"><img src="http://cdn.sheknows.com/articles/2011/04/kids-playing-hens-chicks.jpg"></div>
<div class="diamond-two">
<h3>Title</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.</p>
</div>
</div>
<div class="bottom">
<div class="diamond-one-2"><img src="http://www.joannejacobs.com/wp-content/uploads/2012/06/bigstock-Group-of-kids-playing-with-con-12140777-2.jpg"></div>
<div class="diamond-inverted-2">
<h3>Title</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.</p>
</div>
<div class="diamond-two-2"><img src="http://thinklink.in/wp-content/uploads/child-play-kid-girl-jpg_155838.jpg"></div>
</div>
</div>
CSS
.container{
width: 600px;
}
.diamond-one{
z-index: 1;
float: left;
width: 200px;
height: 200px;
background-color: #FBA919;
position: relative;
}
.diamond-one > h3{
padding: 10px;
color: white;
font-family: Verdana;
margin: 0;
text-align: center;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.diamond-one > p{
padding: 10px;
color: white;
font-family: Verdana;
margin: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.diamond-one::before{
border-color: #FBA919 transparent transparent transparent;
border-style: solid;
border-width: 100px; /* half of diamond width*/
content: "";
position: absolute;
bottom: -200px; /* equals diamond width*/
}
.diamond-two{
z-index: 1;
float: left;
width: 200px;
height: 200px;
background-color: #03A6E1;
position: relative;
}
.diamond-two::before{
border-color: #03A6E1 transparent transparent transparent;
border-style: solid;
border-width: 100px; /* half of diamond width*/
content: "";
position: absolute;
bottom: -200px; /* equals diamond width*/
}
.diamond-two > h3{
padding: 10px;
color: white;
font-family: Verdana;
margin: 0;
text-align: center;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.diamond-two > p{
padding: 10px;
color: white;
font-family: Verdana;
margin: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.diamond-inverted{
overflow: hidden;
float: left;
width: 200px;
height: 200px;
background-color: white;
position: relative;
}
.diamond-inverted::before{
border-color: transparent transparent white transparent;
border-style: solid;
border-width: 100px; /* half of diamond width*/
content: "";
position: absolute;
bottom: 0px; /* equals diamond width*/
}
.diamond-inverted > img{
height: 100%;
width: auto;
}
.diamond-one-2{
overflow: hidden;
z-index: 0;
margin-top: 10px;
float: left;
width: 200px;
height: 250px;
background-color: #FBA919;
position: relative;
}
.diamond-one-2::before{
border-color: white transparent transparent transparent;
border-style: solid;
border-width: 100px; /* half of diamond width*/
content: "";
position: absolute;
top: 0px; /* equals diamond width*/
}
.diamond-one-2 > img{
height: 100%;
width: auto;
}
.diamond-two-2{
overflow: hidden;
z-index: 0;
margin-top: 10px;
float: left;
width: 200px;
height: 250px;
background-color: #03A6E1;
position: relative;
}
.diamond-two-2::before{
border-color: white transparent transparent transparent;
border-style: solid;
border-width: 100px; /* half of diamond width*/
content: "";
position: absolute;
top: 0px; /* equals diamond width*/
}
.diamond-two-2 > img{
height: 100%;
width: auto;
}
.diamond-inverted-2{
margin-top: 10px;
/* overflow: hidden; */
float: left;
width: 200px;
height: 250px;
background-color: #76C043;
position: relative;
}
.diamond-inverted-2::before{
border-color: transparent transparent #76C043 transparent;
border-style: solid;
border-width: 100px; /* half of diamond width*/
content: "";
z-index: 99;
position: absolute;
top: -200px; /* equals diamond width*/
}
.diamond-inverted-2 > h3{
padding: 10px;
color: white;
font-family: Verdana;
margin: 0;
text-align: center;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.diamond-inverted-2 > p{
padding: 10px;
color: white;
font-family: Verdana;
margin: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.diamond-inverted-2 > img{
height: 100%;
width: auto;
}
Here is exactly what you are looking for, play with the values if the size is not correct. I assumed a width of 600px and a height of 400px and sized the rest accordingly.
EDIT
http://jsfiddle.net/ctwheels/9Lz0by3a/
The code is below
HTML
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="test.css">
<link rel="stylesheet" type="text/css" href="test2.css">
</head>
<body>
<div class="container">
<div class="left_top_div text_div">
<div class="text_container">
<h3>My title</h3>
<h5>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec at erat purus. In lobortis mauris felis, vulputate eleifend risus tempor nec. Nullam id placerat enim. Mauris ac risus auctor, tincidunt nulla ac, porta odio. Ut eget vulputate nisl.</h5>
</div>
</div>
<div class="center_bottom_div text_div">
<div class="text_container">
<h3>My title</h3>
<h5>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec at erat purus. In lobortis mauris felis, vulputate eleifend risus tempor nec. Nullam id placerat enim. Mauris ac risus auctor, tincidunt nulla ac, porta odio. Ut eget vulputate nisl.</h5>
</div>
</div>
<div class="right_top_div text_div">
<div class="text_container">
<h3>My title</h3>
<h5>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec at erat purus. In lobortis mauris felis, vulputate eleifend risus tempor nec. Nullam id placerat enim. Mauris ac risus auctor, tincidunt nulla ac, porta odio. Ut eget vulputate nisl.</h5>
</div>
</div>
<div class="left_bottom_div img_div"></div>
<div class="center_top_div img_div"></div>
<div class="right_bottom_div img_div"></div>
<div class="arrow_box_pointdown_left"></div>
<div class="arrow_box_pointup_center"></div>
<div class="arrow_box_pointdown_right"></div>
</div>
</body>
</html>
CSS - test.css
.arrow_box_pointdown_left:after, .arrow_box_pointdown_left:before {
border-style:solid;
border-color: #FBA919 transparent transparent transparent;
content:" ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
top:200px;
}
.arrow_box_pointdown_left:after {
border-top-color: #FBA919;
border-width: 65px 100px 0 100px;
left: 0px;
}
.arrow_box_pointdown_left:before {
border-top-color: grey;
border-width: 76px 116px 0 116px;
left:-16px;
}
.arrow_box_pointup_center:after, .arrow_box_pointup_center:before {
border-style:solid;
border-color: #78C042 transparent transparent transparent;
content:" ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
transform:rotate(180deg);
-ms-transform:rotate(180deg); /* IE 9 */
-webkit-transform:rotate(180deg); /* Opera, Chrome, Safari */
bottom:189px;
}
.arrow_box_pointup_center:after {
border-top-color: #78C042;
border-width: 65px 100px 0 100px;
left: 200px;
}
.arrow_box_pointup_center:before {
border-top-color: grey;
border-width: 76px 116px 0 116px;
left:184px;
}
.arrow_box_pointdown_right:after, .arrow_box_pointdown_right:before {
border-style:solid;
border-color: #0AA3DF transparent transparent transparent;
content:" ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
top:200px;
}
.arrow_box_pointdown_right:after {
border-top-color: #0AA3DF;
border-width: 65px 100px 0 100px;
left: 400px;
}
.arrow_box_pointdown_right:before {
border-top-color: grey;
border-width: 76px 116px 0 116px;
left:384px;
}
CSS - test2.css
.container {
background-color:black;
width:600px;
height:400px;
position:relative;
overflow:hidden;
}
.text_div {
width:200px;
height:200px;
position:absolute;
}
.text_container{
width:180px;
margin-top:-10px;
margin-left:10px;
margin-right:10px;
color:white;
text-align:center;
}
.img_div {
width:200px;
height:200px;
position:absolute;
}
.left_top_div{
top:0px;
left:0px;
background-color:#FBA919;
}
.center_bottom_div{
bottom:0px;
left:200px;
background-color:#78C042;
}
.right_top_div{
top:0px;
right:0px;
background-color:#0AA3DF;
}
.left_bottom_div{
bottom:0px;
left:0px;
background-image:url("http://para.llel.us/themes/salutation-wp/wp-content/uploads/2011/09/sample-image-15.jpg");
background-size:200px 200px;
}
.center_top_div{
top:0px;
left:200px;
background-image:url("http://www.imgcan.com/upload/big/2014/01/10/52cfdc904e162.jpeg");
background-size:200px 200px;
}
.right_bottom_div{
bottom:0px;
right:0px;
background-image:url("http://4nabs.com/upload/local7/_branch_flower_ghibli_grass_highres_kanata_(ta220)_karigurashi_no_arrietty_leaf_minigirl_nature_running_studio_ghibli__Wt18RhKpR1.jpg");
background-size:200px 200px;
}
Check this out: Demo (js fiddle) Demo (js bin)
Its not exactly the same, but I think its close enough.
html:
<div id="wrap">
<div class="diamond"></div>
<div class="diamond2">Your text here</div>
</div>
CSS:
#wrap {
position:relative;
margin-left:100px;
margin-top:100px;
width:150px;
height:150px;
}
.diamond, .diamond2 {
position:absolute;
background-color:yellow;
border:1px solid yellow;
}
.diamond {
height:100px;
margin-left:20px;
width:98px;
/* Rotate div */
transform:rotate(45deg);
-ms-transform:rotate(45deg); /* IE 9 */
-webkit-transform:rotate(45deg); /* Opera, Chrome, and Safari */
}
.diamond2 {
height:200px;
color:black;
width:140px;
margin-top:50px;
text-indent:10px;
}
Have you looked into the clip property. it allows you to cut out shapes from HTML refrenced images.
http://www.w3schools.com/cssref/pr_pos_clip.asp