Is it possible to set image in same shape with clip-path css.
Original Image
Expected image with css
You don't really need clip-path or mask. A skew transformation with border-radius can do it:
.box {
margin:50px;
border-radius:80px 0;
height:300px;
background:red;
position:relative;
background:url(https://i.stack.imgur.com/rYeuk.jpg) center/cover;
transform:skewY(-7deg);
transform-origin:right;
overflow:hidden;
}
.box::before {
content:"";
position:absolute;
background:inherit;
top:-20%;
left:0;
right:0;
bottom:-20%;
transform:skewY(7deg);
}
body {
background:red;
}
<div class="box">
</div>
Related
I there a way to make each border in a div extend 1 or 2 pixels in each way so that they form a cross in each corner?
You can't do it by default css border property. However, you can achieve what you want by trying :before and :after selectors for the div:
<div class="cross-borders"></div>
.cross-borders {
width:200px;
height:200px;
border:1px solid #000;
border-top:0;
border-bottom:0;
position:relative;
margin:20px auto;
}
.cross-borders:before,
.cross-borders:after {
content: ' ';
width:210px;
height:1px;
background-color:#000;
position:absolute;
top:5px;
left:-5px;
}
.cross-borders:after {
top: auto;
bottom: 5px;
}
JSFiddle
I try to position divs absolute in a bootstrap col-
red{
background-color:red;
}
.grid-item{
position:relative;
}
.about{
position:absolute;
left:20px;
top:20px;
}
.app{
position:absolute;
right:10px;
top:10px;
}
Here is my fiddle:
http://jsfiddle.net/nilssi/ah7m2k01/5/
The positions a good, but i would aspect a red background.
Try giving height and width to .red you can see that red color gets applied:
.red{
background-color:red;
height:200px;
width:200px;
}
DEMO
I am trying to create background carve in CSS. Take a look in the picture below.
How can I add radius like this in CSS3? Anyone can help?
Use:
border-top-left-radius: 50%;
border-top-right-radius: 50%;
I made an example of it here: http://jsfiddle.net/DFs6H/2/
Add another div on the bottom with a border radius.
html:
<div class="content">
<div class="bottom_border"></div>
</div>
css:
.content{
background:#CCC;
height:100px;
width:100px;
position:relative;
overflow:hidden
}
.bottom_border {
position:absolute;
top:0;
bottom:0;
background:#FFF;
width:100px;
height:20px;
top:90px;
bottom:-10px;
border-radius: 50%
}
suppose i have a div, i want it to be out of visible area of computer monitor screen, so that when i use CSS transitions to move it to a specific position, an effect of element moving in slowly from outside of screen is created, and i also would like to create its reverse effect.
position: absolute; then do something like left: -100px;
working example(hover over the box and wait): http://jsfiddle.net/fDnPj/
http://jsfiddle.net/DZFtt/
<div id="example"></div>
<div id="example2"></div>
<div id="example3"></div>
#example{
width:50px;
height:50px;
background-color: #386a95;
position:relative; /*Not moved*/
}
#example2{
width:50px;
height:50px;
background-color: rgb(177, 35, 35);
position:relative;
left:-25px; /*Pushed halfway off the screen*/
}
#example3{
width:50px;
height:50px;
background-color: green;
position:relative;
left:-50px; /*This is now totally hidden from view*/
}
IF you know the width of the div you can use the combination of position and left property like this
#my-div {
position:absolute;
left:-100px;
top:0;
width:100px;
background-color:red;
}
<div id="my-div">Hello</div>
Play here by adjusting the left property.
I have a middleContent div which has two sub-divs acting as columns. The middleMain div works fine, the middleRight div doesn't show unless I fill it with some content or use absolute positioning.
This is a picture of my page:
http://imageshack.us/photo/my-images/403/tempzk.jpg/
With the following CSS:
#middleContent
{
position:relative;
min-height:500px;
height:auto;
}
#middleMain
{
float:left;
height:100%;
left:0;
right:auto;
}
#middleRight
{
position:absolute;
float:right;
width:100px;
height:100%;
right:0;
background-color:Orange;
top: 0px;
}
However, I need it to work with relative positioning since the height expands depending on the content in middleMain. MiddleRight doesn't have any content in it (but needs the capability to add content so I can't just use a picture), so I basically need to display an empty div (but with background color) that takes up the height of the whole page.
change your CSS to :
#middleContent
{
position:relative;
min-height:500px;
height:auto;
overflow: hidden;
}
#middleMain
{
float:left;
height:100%;
left:0;
right:auto;
}
#middleRight
{
position:relative;
float:right;
width:100px;
height:100%;
right:0;
background-color:Orange;
top: 0px;
padding-bottom: 9000px;
margin-bottom: -9000px;
}
http://jsfiddle.net/fXHqL/1/
Add this line to #middleRight
display:block;
it should work.