I would want to code a box in HTML like the one I have added in the picture with the blue box cut at the top right corner.
I would like to know if I can do this or if this has to be taken as an image. Kindly do let me know.
I would want to code a box in HTML like the one I have added in the picture with the blue box cut at the top right corner.
I would like to know if I can do this or if this has to be taken as an image. Kindly do let me know.
You can make it with css: http://jsfiddle.net/Cqnaa/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Hello</title>
<style>
body{
margin: 20px;
}
.box:after {
content: "";
position: absolute;
top: 0px;
right: 0px;
border-width: 20px 20px 0 0;
border-style: solid;
border-color: #fff transparent;
display: block;
width: 0;
}
.box {
color: #fff;
background-color: #bbd0ed;
position: relative;
height: 80px;
width: 150px;
padding: 10px;
}
</style>
</head>
<body>
<p class="box">
Hello!
</p>
</body>
</html>
gl hf
This can be done with CSS:
.box-corner {
/* You would prefer a png for the transparent background where the corner is */
background-image: url('box-background.jpg');
padding: 10px 10px 0 0; /* Assuming the corner is 10x10 */
}
And then instantiate it like this:
<div class="box-corner">Content</div>
Take a DIV with some height and width with some background color. Then add a child div with background as the crop is there in image. Set the position of the child div as relative and set top and right to 0. Like below
#childDiv{
position : relative;
background-image : url("cropedMark.png)"
width : "Some width";
height : "Some height";
top : 0;
right : 0
}
Hope this helps.
Here is an exact answer. http://jsfiddle.net/swGvr/
<style>
#target {
border-top: 30px solid transparent;
border-left: 30px solid #4c4c4c;
border-right: 30px solid #4c4c4c;
border-bottom: 30px solid #4c4c4c;
width:200px;
height:100px;
}
#target > div {
background-color:#4c4c4c;
width:230px;
height:130px;
margin-top:-30px;
margin-left:-30px;
position:absolute;
}
</style>
<div id="target"><div></div></div>
There are two CSS sharing width and height. You can generate another automatically using jQuery as well.