I want this: http://gyazo.com/0fe69e349ed5cd4e72a08ed8e60af5d4
But I can't manage to achieve it.
I can not change the image.
I have used an image as a mask, but that gives me this: http://gyazo.com/b69e840d095212bce422252cec081fe9
Is there a way to make the side parts white aswell?
My code:
#section1{
height:275px;
width:100%;
background-image: url('/img/paral1.jpg');
background-position: center top;
background-repeat:no-repeat;
background-size: 100% 916px;
}
.overlay{
position: absolute;
margin-top:180px;
height:100px;
width:100%;
overflow: hidden;
}
.mask{
margin: 0 auto;
background-image: url('/img/section1.png');
height:100px;
width:1080px;
background-size:100% 100%;
}
edit: JSfiddle: http://jsfiddle.net/31kxqmLt/
JSfiddle in fullscreen: http://jsfiddle.net/31kxqmLt/embedded/result/
edit edit: The mask must have a width of 1080px and the rest of the space should be white.
I made this Html/css example of the shape you are trying to make.
It uses background image, pseudo elements and skewX to give the transparent cut out effect on bottom left and bottom right. It also is responsive :
DEMO
output :
.wrap {
width:100%;
padding-bottom:30%;
position:relative;
}
.wrap:before {
content:'';
background-image: url(http://i.imgur.com/ug3M32a.jpg);
background-size:100% auto;
position:absolute;
width:100%;
left:0;
height:50%;
}
.b{
position:absolute;
bottom:0;
width:50%; height:50%;
}
.l{
left:5%;
transform-origin: 0 0;
transform: skewX(45deg);
overflow:hidden;
border-bottom-left-radius:3%;
}
.r{
right:5%;
transform-origin: 100% 0;
transform: skewX(-45deg);
overflow:hidden;
border-bottom-right-radius:3%;
}
.l:before, .r:before{
content:'';
display:block;
width:100%; height:100%;
background-size: 200%;
background-image: url(http://i.imgur.com/ug3M32a.jpg);
}
.l:before{
background-position: 10% -100%;
transform-origin: 0 0;
transform: skewX(-45deg);
}
.r:before{
background-position: 90% -100%;
transform-origin: 100% 0;
transform: skewX(45deg);
}
body {
padding:20px 10%;
background-image : url(http://i.imgur.com/k8BtMvj.jpg);
background-size:cover;
}
<div class="wrap">
<div class="b l"></div>
<div class="b r"></div>
</div>
Js fiddle
full screen
Js fiddle
edited the mask image
set mask width to 100% so that it fits in all the resolutions
.mask{
margin: 0 auto;
background: url('http://s29.postimg.org/5g7z03ypz/image.png') no-repeat bottom;
height:100px;
width:100%;
background-size:100% auto;
}
for smaller resolution min-width 300
#section1{
max-height:200px;
min-height:30%;
overflow:hidden;
position:relative;
}
JS Fiddle
Related
Please help me change the cutout from .top so that it is on top and not on the right.
As shown in the image.
Thank you very much in advance.
I really hope for your help, I'm new to this business.
Source code: Source code
.box {
margin-top:120px;
width:200px;
height:100px;
background:white;
}
.box .top {
height:100px;
width:150px;
transform:translateY(-100%);
position:relative;
background:#fff;
}
.top:before,
.top:after{
content:"";
position:absolute;
top:0;
width:50px;
left:100%;
bottom:50%;
background:
radial-gradient(100% 50% at top left, #fff 98%,transparent 100%) right,
radial-gradient(100% 50% at bottom right, transparent 98%,#fff 100%) left;
background-size:50% 100%;
background-repeat:no-repeat;
}
.top:after {
transform-origin:bottom;
transform:scaleY(-1);
}
body {
background:pink;
}
<div class="box">
<div class="top"></div>
</div>
You can adjust your code like below:
.box {
margin-top:90px; /* make it at lealst the same as the height of the pseudo element */
width:200px;
height:100px;
background:white;
position:relative;
}
.box:before,
.box:after{
content:"";
position:absolute;
bottom:100%;
width:50%;
left:0;
height:80px; /* adjust this to control the height */
background:
radial-gradient(50% 100% at bottom left, #fff 98%,#0000) top,
radial-gradient(50% 100% at top right , #0000 98%,#fff) bottom;
background-size:100% 50%;
background-repeat:no-repeat;
}
.box:after {
transform-origin:right;
transform:scaleX(-1);
}
body {
background:pink;
}
<div class="box">
</div>
I have a problem with my website slider images. I set my slider wrap and slider inner frame width to 100% but when I change the screen size the images size does not change. Also I set the images width to max-width:100% and the height of them to auto.
#sliderFrame {
position:relative;
width:100%;
margin: 0 auto; /*center-aligned*/
}
#slider, #slider div.sliderInner {
width:1280px;height:auto;/* Must be the same size as the slider images */
border-radius: 6px;
}
#slider {
background:#fff url(loading.gif) no-repeat 50% 50%;
position:relative;
transform: translate3d(0,0,0);
box-shadow: 0px 1px 5px #999999;
}
#slider a.imgLink, #slider .video {
z-index:2;
cursor:pointer;
position:absolute;
top:0px;left:0px;border:0;padding:0;margin:0;
width:100%;height:100%;
}
#slider div.loading {
max-width:100%; height:auto;
background:transparent url(loading.gif) no-repeat 50% 50%;
filter: alpha(opacity=60);
opacity:0.6;
position:absolute;
left:0;
top:0;
z-index:9;
}
#slider img, #slider>b, #slider a>b {
position:absolute;
border:none;
display:none;
max-width:100%;
height:auto;
}
#slider div.sliderInner {
overflow:hidden;
-webkit-transform: rotate(0.000001deg);/* fixed the Chrome not crop border-radius bug*/
position:absolute;
top:0;
left:0;
max-width:100%;
height:auto;
}
<div id="sliderFrame">
<div id="slider">
<img src="image/Index_1600x500.jpg" alt="#cap1"/>
<img src="image/Index_TrackerPnale_1600x500.jpg"/>
<img src="image/Index_HyundaiSantafe_1600x500.jpg" alt="#cap2"/>
<img src="image/Index_Support.jpg" title="Support Team"/>
<img src="image/Index_SocialMedia_1600x500.jpg" title="Social Medias"/>
</div>
</div>
Your CSS doesn't really say much about your HTML - Also, we have no clue on what you really mean by slider - But follow this fiddle: https://jsfiddle.net/p3r1x5sj/ and see the very minimal CSS you're looking for.
#sliderFrame {
width:100%;
height:100px;
position:relative;
}
#sliderFrame #slider {
width:100%;
height:100%;
position:relative;
background:#fff url(loading.gif) no-repeat 50% 50%;
box-shadow: 0px 1px 5px #999999;
}
#sliderFrame #slider img {
width:100%;
position:absolute;
top:0;
left:0;
}
The img tags are what you have to control. Also, unless you crop the images using overflow:hidden; on your outermost container, the images may be all different heights. In this case you may want to consider using divs with background-images
I'm trying to create a skewed section with a picture background. The point is that I want this background with the skew of the parent cancelled. I tried to achieve this with a pseudo-element.
I don't understand why the overflow:hidden of the parent does not affect the ::after element. Could someone help?
.main::after {
content:"";
background: url("https://images.unsplash.com/photo-1420310414923-bf3651a89816?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=47f355d1a7520ad5f1718e9388dd4967");
background-size:cover;
position:absolute;
display:block;
width: 110%;
height:110%;
transform: rotateZ(5deg) skew(5deg);
Here is the code and example: http://codepen.io/anon/pen/jWEZxK
Thanks in advance
Chris.
Try to this
Demo
* {
margin:0;
padding:0;
/*height:100%;*/
}
body {
background: #272727;
}
section {
width:100%;
min-height:500px;
transform: rotateZ(-5deg) skew(-5deg);
}
.main {
background-color: crimson;
overflow:hidden;
position:relative;
z-index:1;
}
.main::after {
content:"";
background: url("https://images.unsplash.com/photo-1420310414923-bf3651a89816?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=47f355d1a7520ad5f1718e9388dd4967");
background-size:cover;
position:absolute;
display:block;
left:-10%;
right:-10%;
top:-10%;
bottom:-10%;
transform: rotateZ(5deg) skew(5deg);
z-index:2;
}
<section class="main">
</section>
the after pseude needs the same deffinitions as parent element .. to we just repeat declarations..
http://codepen.io/mkdizajn/pen/GogQev?editors=110
overflow:hidden;
transform: rotateZ(0deg) skew(0deg); }
cheers :)
I have a horizontal slider which i need to make responsive so that the images used in it can take the size of any screen available.The problem that i am facing here is that the images are getting cut from right side of the Screen which i don't want.
Here is my HTML..
<div id="sliderFrame">
<div id="slider">
<img src="images/1.jpg" style="width:100%;" alt="" />
<img src="images/2.jpg" style="width:100%;" alt="" />
</div>
</div>
And Here is my Full CSS.I am sorry if the Css is too long but seriously i was not able to find out that which property i should change to get the result.
#sliderFrame
{
position:relative;
width:100%;
}
#slider, #slider div.sliderInner {
width:100%;height:306px;/* Must be the same size as the slider images */
}
#slider {
background:#fff url(loading.gif) no-repeat 50% 50%;
position:relative;
margin:0 auto; /*center-aligned*/
transform: translate3d(0,0,0);
box-shadow: 0px 1px 5px #999999;
}
/* image wrapper */
#slider a.imgLink, #slider div.video {
z-index:2;
position:absolute;
top:0px;left:0px;border:0;padding:0;margin:0;
width:100%;height:100%;
}
#slider .video {
background:transparent url(video.png) no-repeat 50% 50%;
}
/* Caption styles */
#slider div.mc-caption-bg, #slider div.mc-caption-bg2 {
position:absolute;
width:100%;
height:auto;
padding:10px 0;/* 10px will increase the height.*/
left:0px; /*if the caption needs to be aligned from right, specify by right instead of left. i.e. right:20px;*/
bottom:0px;/*if the caption needs to be aligned from top, specify by top instead of bottom. i.e. top:150px;*/
z-index:3;
overflow:hidden;
font-size: 0;
}
#slider div.mc-caption-bg
{
/* NOTE: Its opacity is to be set through the sliderOptions.captionOpacity setting in the js-image-slider.js file.*/
background:Black;/* or any other colors such as White, or: background:none; */
}
#slider div.mc-caption-bg2 {
background:none;
}
#slider div.mc-caption {
font: bold 14px/20px Arial;
color:#EEE;
z-index:4;
text-align:center;
background:none;
}
#slider div.mc-caption a {
color:#FB0;
}
#slider div.mc-caption a:hover {
color:#DA0;
}
/* ------ built-in navigation bullets wrapper ------*/
/* Note: check themes\2\js-image-slider.css to see how to hide nav bullets */
#slider div.navBulletsWrapper {
top:320px;/* Its position is relative to the #slider */
text-align:center;
background:none;
position:relative;
z-index:5;
}
/* each bullet */
#slider div.navBulletsWrapper div
{
width:11px; height:11px;
font-size:0;color:White;/*hide the index number in the bullet element*/
background:transparent url(bullet.png) no-repeat 0 0;
display:inline-block; *display:inline; zoom:1;
overflow:hidden;cursor:pointer;
margin:0 6px;/* set distance between each bullet*/
}
#slider div.navBulletsWrapper div.active {background-position:0 -11px;}
/* --------- Others ------- */
#slider div.loading
{
width:100%; height:100%;
background:transparent url(loading.gif) no-repeat 50% 50%;
filter: alpha(opacity=60);
opacity:0.6;
position:absolute;
left:0;
top:0;
z-index:9;
}
#slider img, #slider>b, #slider a>b {
position:absolute; border:none; display:none;
}
#slider div.sliderInner {
overflow:hidden;
-webkit-transform: rotate(0.000001deg);/* fixed the Chrome not crop border-radius bug*/
position:absolute; top:0; left:0;
}
#slider>a, #slider video, #slider audio {display:none;}
This is the image of the screenshot which is not displaying as the complete image it is cut from the right end of the original image
To make images responsive use widely used code snippet for img tags
#slider > img {
display: block;
max-width: 100%;
height: auto;
}
Sorry for my english.
I have a problem. I need to create a DIV inside another DIV, which has to have a white background. I tried using skew, but It didnt work well.
Here is an image:
There are at least several ways to achieve this, however the simplest way may be using linear-gradient background. Its quality is not really good compared with others but it's totally acceptable.
Try this:
div {
width:600px;
height:300px;
background:teal;
border:1px solid teal;
}
.top {
width:100%;
height:100px;
font-size:25px;
padding-left:30px;
background:linear-gradient(175deg, white 60%, transparent 62%);
border:none;
box-sizing:border-box;
}
HTML:
<div>
<div class='top'>Custom<br/>Home</div>
</div>
Demo.
You can do that with a pseudo element and transform rotate :
DEMO
HTML :
<div id="header">
Custom<br/>
Home
</div>
<div id="content"></div>
CSS :
#header{
background:#fff;
position:relative;
height:50px;
z-index:1;
font-size:30px;
padding-left:10%;
}
#header:before{
content:'';
position:absolute;
bottom:0;
right:0;
width:110%;
height:1000%;
background:inherit;
z-index:-1;
border-bottom:2px solid #636A6E;
-webkit-backface-visibility: hidden; /* to fix pixelisation in chrome */
-ms-transform-origin:100% 100%;
-webkit-transform-origin:100% 100%;
transform-origin:100% 100%;
-webkit-transform: rotate(-5deg);
-ms-transform: rotate(-5deg);
transform: rotate(-5deg);
}
#content{
min-height:500px;
background:#778385;
}
Since you need the border in your diagonal div, try this:
CSS:
.logo {
width:110%;
height:147px;
top:-10%;
left:-14px;
border:2px solid black;
position:absolute;
background:#fff;
transform:rotate(-7deg);
-ms-transform:rotate(-7deg);
/* IE 9 */
-webkit-transform:rotate(-7deg);
/* Opera, Chrome, and Safari */
}
.container {
width:100%;
height:612px;
overflow:hidden;
background:#7b8284;
position:relative;
}
.inner {
position:absolute;
height:200px;
transform:rotate(7deg);
-ms-transform:rotate(7deg);
/* IE 9 */
-webkit-transform:rotate(7deg);
/* Opera, Chrome, and Safari */
padding:20px 90px;
top:30%;
font-size:30px;
}
HTML:
<div class="container">
<div class="logo">
<div class="inner">My Logo</div>
</div>
</div>
Demo: http://jsfiddle.net/lotusgodkk/BKfe9/1/
You can modify the top,left,font-size,background-color,transform, border as per your need
If you want to do it in pure CSS I would recommend using the transform: rotate(xxx) feature of CSS3. I've created a JS-Fiddle that will help you get started (not the best solution...), it is not based on your fiddle: http://jsfiddle.net/syTu7/
I think I understand your question, I think my example will help
HTML
<div class="wrapper">
<div class="innter">some text</div>
</div>
CSS
.wrapper {
position: relative;
width: 960px;
margin: 0 auto;
background: #ddd;
min-height: 100%;
height: 800px;
}
.innter {
height: 500px;
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: #ececec;
}
In HTML,
<div class="wrapper">
<div class="inner">some content</div>
</div>
In CSS,
.inner {
background: #fff;
}