does anyone know how I can center the white circle into to middle of the blue circle and set the white circle above all other elements? I tried with relative and absolute positioning and with the z-index but I couldnt get it to work. I'm kinda a noob in CSS
.start-container {
height: 100vh;
display: grid;
grid-template-rows: 20% 65% 15%;
grid-template-areas: "header" "startpage" "footer";
}
.header {}
.header-shape {
height: 100%;
background-color: blue;
clip-path: polygon(0 60%, 100% 40%, 100% 100%, 0% 100%);
}
.profile-shape {
position: absolute;
top: 7vw;
left: 65vw;
width: 10vw;
height: 10vw;
background-color: blue;
border-radius: 50%;
filter: drop-shadow(0px 3px 30px rgba(0, 0, 0, 0.60));
}
.profile-picture {
width: 90%;
height: 90%;
background-color: white;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
margin: -50% 0 0 -50%;
}
.startpage {}
.footer {
background-color: yellow;
}
<div class="start-container">
<div class="header">
<div class="profile-shape">
<div class="profile-picture"></div>
</div>
<div class="header-shape"></div>
</div>
<div class="startpage"></div>
<div class="footer"></div>
</div>
If you give your shape a z-index, it will put it on top. Make it flex with justify-content and align-items center and that will centre your profile (after removing the absolute positioning):
.start-container {
height: 100vh;
display: grid;
grid-template-rows: 20% 65% 15%;
grid-template-areas: "header" "startpage" "footer";
}
.header {}
.header-shape {
height: 100%;
background-color: blue;
clip-path: polygon(0 60%, 100% 40%, 100% 100%, 0% 100%);
}
.profile-shape {
position: absolute;
top: 7vw;
left: 65vw;
width: 10vw;
height: 10vw;
background-color: blue;
border-radius: 50%;
filter: drop-shadow(0px 3px 30px rgba(0, 0, 0, 0.60));
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
}
.profile-picture {
width: 90%;
height: 90%;
background-color: white;
border-radius: 50%;
}
.startpage {}
.footer {
background-color: yellow;
}
<div class="start-container">
<div class="header">
<div class="profile-shape">
<div class="profile-picture"></div>
</div>
<div class="header-shape"></div>
</div>
<div class="startpage"></div>
<div class="footer"></div>
</div>
Per comment, if you want blue circle (changed to red in example below) below and white above, you would need to have an extra object otherwise the white circle will always be on the same stacking context as it's parent:
.start-container {
height: 100vh;
display: grid;
grid-template-rows: 20% 65% 15%;
grid-template-areas: "header" "startpage" "footer";
}
.header {}
.header-shape {
height: 100%;
background-color: blue;
clip-path: polygon(0 60%, 100% 40%, 100% 100%, 0% 100%);
}
.profile-placement {
position: absolute;
top: 7vw;
left: 65vw;
width: 10vw;
height: 10vw;
}
.profile-placement--shape {
background-color: red;
border-radius: 50%;
filter: drop-shadow(0px 3px 30px rgba(0, 0, 0, 0.60));
}
.profile-placement--picture {
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
}
.profile-picture {
width: 90%;
height: 90%;
background-color: white;
border-radius: 50%;
}
.startpage {}
.footer {
background-color: yellow;
}
<div class="start-container">
<div class="header">
<div class="profile-placement profile-placement--shape">
</div>
<div class="profile-placement profile-placement--picture">
<div class="profile-picture"></div>
</div>
<div class="header-shape"></div>
</div>
<div class="startpage"></div>
<div class="footer"></div>
</div>
Just adjust the margin with the remaining height and width on the profile-picture class.
The remaining size is 10% height and 10% weight. So there will be +5%(-45%) on the left margin and +5%(-45%) on the top margin. It will make the circle center
.start-container{
height: 100vh;
display: grid;
grid-template-rows: 20% 65% 15%;
grid-template-areas:
"header"
"startpage"
"footer"
;
}
.header{
}
.header-shape{
height: 100%;
background-color: blue;
clip-path: polygon(0 60%, 100% 40%, 100% 100%, 0% 100%);
}
.profile-shape{
position: absolute;
top: 7vw;
left: 65vw;
width: 10vw;
height: 10vw;
background-color: blue;
border-radius: 50%;
filter: drop-shadow(0px 3px 30px rgba(0,0,0,0.60));
}
.profile-picture{
width: 90%;
height: 90%;
background-color: white;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
margin: -45% 0 0 -45%;
}
.startpage{
}
.footer{
background-color: yellow;
}
<div class="start-container">
<div class="header">
<div class="profile-shape">
<div class="profile-picture"></div>
</div>
<div class="header-shape"></div>
</div>
<div class="startpage"></div>
<div class="footer"></div>
</div>
Related
As such: https://i.stack.imgur.com/UdHNE.png
CSS border, clip path, etc?
I've tried the following:
div#box{
width: 38px;
height: 500px;
border: 13px solid black;
border-color: transparent black transparent transparent;
border-radius: 0 100% 100% 0;
}
<div id="box"></div>
But it's not giving me the result I'm looking for (the curve is too subtle).
I've also tried using clip path but the transparent element won't "cut" into the other one obviously since it's transparent.
body {
background-color: lightblue;
}
.one {
height: 500px;
width: 38px;
background-color: white;
clip-path: ellipse(38px 50% at 0% 50%);
position: absolute;
right: 50%;
top: 0;
}
.two {
height: 500px;
width: 38px;
background-color: transparent;
clip-path: ellipse(38px 50% at 0% 50%);
position: absolute;
right: calc(50% + 13px);
top: 0;
}
<div class="one"></div>
<div class="two"></div>
Any help would be greatly appreciated.
Can you please try this and only play with second[180%] and third[-2%] value.
In here we create a required clip-path than we create another div which will create us a middle space and aplly position: absolute ,overflow:hidden to create same clip-path in red div and than we set background-color of middle div as same as screens background-color.
z-index are need to be .one > .middle > .two
clip-path: ellipse(100% 180% at -2% 50% )
body {
position: relative;
min-height: 100vh;
display: flex;
place-items: center;
background-color: bisque;
}
.one{
position: relative;
height: 500px;
width: 500px;
background-color: green;
clip-path: ellipse(100% 180% at -2% 50% ) ;
z-index: 3;
}
.middle{
position: absolute;
z-index: 2;
height: 500px;
width: 500px;
clip-path: ellipse(100% 180% at -2% 50% ) ;
left:25px;
overflow: hidden;
background-color: bisque;
}
.two{
position: relative;
z-index: 1;
right:25px;
height: 500px;
width: 500px;
background-color: red;
}
<div class="one"></div>
<div class="middle"></div>
<div class="two"></div>
I have an image on a triangle background, however there is seen a line crossing the image. I tried using z-index together with position both relative and absolute, but it doesn't seem to work. Can someone help me out? Much appreciated.
/* Reset. */
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-size: 100%;
font-family: Arial, Helvetica, sans-serif;
}
/* Panels. */
.splitview {
position: relative;
width: 100%;
min-height: 45vw;
overflow: hidden;
}
.panel {
position: absolute;
width: 100vw;
min-height: 45vw;
overflow: hidden;
}
.panel .content {
position: absolute;
width: 100vw;
min-height: 45vw;
color: #FFF;
}
.panel .description {
width: 25%;
position: absolute;
top: 50%;
transform: translateY(-50%);
text-align: center;
}
.panel img {
box-shadow: 0 0 20px 20px rgba(0, 0, 0, 0.15);
width: 35%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.bottom {
background-color: rgb(44, 44, 44);
z-index: 1;
}
.bottom .description {
right: 5%;
}
.top {
background-color: rgb(77, 69, 173);
z-index: 2;
width: 50vw;
/*-webkit-clip-path: polygon(60% 0, 100% 0, 100% 100%, 40% 100%);
clip-path: polygon(60% 0, 100% 0, 100% 100%, 40% 100%);*/
}
.top .description {
left: 5%;
}
/* Handle. */
.handle {
height: 100%;
position: absolute;
display: block;
width: 5px;
top: 0;
left: 50%;
z-index: 3;
}
/* Skewed. */
.skewed .handle {
top: 50%;
transform: rotate(30deg) translateY(-50%);
height: 200%;
-webkit-transform-origin: top;
-moz-transform-origin: top;
transform-origin: top;
}
.skewed .top {
transform: skew(-30deg);
margin-left: -1000px;
width: calc(50vw + 1000px);
}
.skewed .top .content {
transform: skew(30deg);
margin-left: 1000px;
}
/* Responsive. */
#media (max-width: 900px) {
body {
font-size: 75%;
}
}
<div class="splitview skewed">
<div class="panel bottom">
<div class="content">
<div class="description">
<h1>My name is John Snow.</h1>
<p>I like making popcorn with icicles alot.</p>
</div>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/original-image.jpg" alt="Original">
</div>
</div>
<div class="panel top">
<div class="content">
<div class="description">
<h1>I dream about this girl everyday, but cannot seem to forget her.</h1>
<p>People say not many people can fall in love, and it's good I can experience it, but what is unrequited love worth actually.</p>
</div>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/original-image.jpg" alt="Duotone">
</div>
</div>
<div class="handle"></div>
</div>
Use only one image and put it outside the panels.
/* Reset. */
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-size: 100%;
font-family: Arial, Helvetica, sans-serif;
}
.splitview img {
z-index: 3;
box-shadow: 0 0 20px 20px rgba(0, 0, 0, 0.15);
width: 35%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* Panels. */
.splitview {
position: relative;
width: 100%;
min-height: 45vw;
overflow: hidden;
}
.panel {
position: absolute;
width: 100vw;
min-height: 45vw;
overflow: hidden;
}
.panel .content {
position: absolute;
width: 100vw;
min-height: 45vw;
color: #FFF;
}
.panel .description {
width: 25%;
position: absolute;
top: 50%;
transform: translateY(-50%);
text-align: center;
}
.bottom {
background-color: rgb(44, 44, 44);
z-index: 1;
}
.bottom .description {
right: 5%;
}
.top {
background-color: rgb(77, 69, 173);
z-index: 2;
width: 50vw;
/*-webkit-clip-path: polygon(60% 0, 100% 0, 100% 100%, 40% 100%);
clip-path: polygon(60% 0, 100% 0, 100% 100%, 40% 100%);*/
}
.top .description {
left: 5%;
}
/* Handle. */
.handle {
height: 100%;
position: absolute;
display: block;
width: 5px;
top: 0;
left: 50%;
z-index: 3;
}
/* Skewed. */
.skewed .handle {
top: 50%;
transform: rotate(30deg) translateY(-50%);
height: 200%;
-webkit-transform-origin: top;
-moz-transform-origin: top;
transform-origin: top;
}
.skewed .top {
transform: skew(-30deg);
margin-left: -1000px;
width: calc(50vw + 1000px);
}
.skewed .top .content {
transform: skew(30deg);
margin-left: 1000px;
}
/* Responsive. */
#media (max-width: 900px) {
body {
font-size: 75%;
}
}
<div class="splitview skewed">
<div class="panel bottom">
<div class="content">
<div class="description">
<h1>My name is John Snow.</h1>
<p>I like making popcorn with icicles alot.</p>
</div>
</div>
</div>
<div class="panel top">
<div class="content">
<div class="description">
<h1>I dream about this girl everyday, but cannot seem to forget her.</h1>
<p>People say not many people can fall in love, and it's good I can experience it, but what is unrequited love worth actually.</p>
</div>
</div>
</div>
<div class="handle"></div>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/original-image.jpg" alt="Duotone">
</div>
It can be hard to get two elements exactly lined up when there is some sort of transform or resizing going on because the arithmetic can result in part CSS pixel being required, and that can cause trouble translating to the multiple screen pixels that can make up a CSS pixel on modern, high res screens.
Your spurious line looks like not as wide as a CSS pixel and could be screen pixels 'left behind' during these calculations.
I found your layout quite hard to follow as there were skews and other transforms.
Looking at the layout I wonder if a simpler approach - a 3 column grid with flex used to center items within the panels might suffice? It would make maintenance easier. The skews seemed to be needed for the background 'triangular' shapes and this snippet replaces them with a sloping linear gradient as the content element's background. No skewing or other transforms are required.
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-size: 100%;
font-family: Arial, Helvetica, sans-serif;
}
.content {
position: absolute;
min-height: 45vw;
width: 100vw;
color: #fff;
text-align: center;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
background-image: linear-gradient(-60deg, rgb(44, 44, 44) 0, rgb(44, 44, 44) 48%, rgb(77, 69, 173) 48%, rgb(77, 69, 173) 100%);
}
.panel {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.panel .description {
width: 75%;
}
.panel img {
width: 100%;
height: 100%;
object-fit: contain;
/* commented out as I don't understand it's use here box-shadow: 0 0 20px 20px rgba(0, 0, 0, 0.15);*/
}
<body>
<div class="content">
<div class="panel">
<div class="description">
<h1>I dream about this girl everyday, but cannot seem to forget her.</h1>
<p>People say not many people can fall in love, and it's good I can experience it, but what is unrequited love worth actually.</p>
</div>
</div>
<div class="panel">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/original-image.jpg" alt="Original">
</div>
<div class="panel">
<div class="description">
<h1>My name is John Snow.</h1>
<p>I like making popcorn with icicles alot.</p>
</div>
</div>
</div>
<div class="handle"></div>
</div>
</body>
I'm trying to put together a specific design for a website we are building. The header needs a parallelogram shape above it, and a trapezium to the right of the container, as shown below.
I've managed to add the parallelogram above the container, but i'm struggling to get the element to the right of the container. The following shows what i've done.
HTML
<div class="container">
<div class="row">
<div class="col">
Content Here
</div>
</div>
</div>
CSS
.container {
width: 700px;
}
.container:before {
content:'';
width: 100%;
height: 30px;
transform: skew(45deg);
background: #254896;
background: linear-gradient(90deg, #254896, #2c2b5b 100%);
display: block;
}
.row {
background: #f8f9fa;
}
.row:before {
content:'';
width: 100%;
height: 0;
border-image-source: linear-gradient(90deg, #FF0000, #940202);
border-image-slice: 1;
border-top: 30px solid red;
border-left: 30px solid transparent;
position: absolute;
left: 800px;
top: 30px;
}
.col {
background-color: #ddd;
padding: 10px;
}
https://jsfiddle.net/scarrott/vgtpna14/
The issues i'm having are:
Getting the red shape to sit neatly to the right of the container regardless of screen size.
Putting a gradient fill on the trapezium shape. If I use border-image-source it makes the shape a rectangle.
Any help would be greatly appreciated.
Here is an idea using multiple background. I used 400px instead of 700px to better see in the snippet
body {
overflow-x: hidden;
}
.container {
--w:400px;
max-width: var(--w);
position: relative;
margin: 40px auto;
}
.container:before {
content: '';
position: absolute;
top: -20px;
left: 0;
width: calc(50vw + var(--w)/2);
min-width: 100%;
height: 40px;
transform: skew(45deg);
transform-origin: top;
background:
linear-gradient(90deg, #254896, #2c2b5b 100%) top left/var(--w) 50%,
linear-gradient(90deg, #FF0000, #940202) bottom right /calc(100% - var(--w)) 50%;
background-repeat: no-repeat;
}
.row {
background: #f8f9fa;
}
.col {
padding: 10px;
}
<div class="container">
<div class="row">
<div class="col">
Content Here
</div>
</div>
</div>
Another idea with clip-path:
body {
overflow-x: hidden;
}
.container {
--w:400px;
max-width: var(--w);
position: relative;
margin: 40px auto;
}
.container:before {
content: '';
position: absolute;
top: -20px;
left: 0;
width: calc(50vw + var(--w)/2);
min-width: 100%;
height: 40px;
clip-path:polygon(0 0, calc(var(--w) - 20px) 0,var(--w) 50%,100% 50%,100% 100%,calc(var(--w) + 20px) 100%,var(--w) 50%, 20px 50%);
background:
linear-gradient(90deg, #254896, #2c2b5b 100%) top left/var(--w) 50%,
linear-gradient(90deg, #FF0000, #940202) bottom right /calc(100% - var(--w)) 50%;
background-repeat: no-repeat;
}
.row {
background: #f8f9fa;
}
.col {
padding: 10px;
}
<div class="container">
<div class="row">
<div class="col">
Content Here
</div>
</div>
</div>
Including bootstrap
body {
overflow-x: hidden;
}
.container {
--w: 540px;
position: relative;
margin-top: 40px;
}
#media (min-width: 768px) {
.container {
--w: 720px;
}
}
#media (min-width: 992px) {
.container {
--w: 960px;
}
}
#media (min-width: 1200px) {
.container {
--w: 1140px;
}
}
.container:before {
content: '';
position: absolute;
top: -20px;
left: 0;
width: calc(50vw + var(--w)/2);
min-width: 100%;
height: 40px;
clip-path: polygon(0 0, calc(var(--w) - 20px) 0, var(--w) 50%, 100% 50%, 100% 100%, calc(var(--w) + 20px) 100%, var(--w) 50%, 20px 50%);
background:
linear-gradient(90deg, #254896, #2c2b5b 100%) top left/var(--w) 50%,
linear-gradient(90deg, #FF0000, #940202) bottom right /calc(100% - var(--w)) 50%;
background-repeat: no-repeat;
}
.row {
background: #f8f9fa;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<div class="container">
<div class="row">
<div class="col">
Content Here
</div>
</div>
</div>
Another approach would be to to have the 2 parallelogram shapes inside the container div with specified percentages.
.row::before {
content: '';
width: calc(70% - 14px);
height: 30px;
transform: skew(45deg);
background: #254896;
background: linear-gradient(90deg, #254896, #2c2b5b 100%);
}
.row::after {
content: '';
width: calc(30% - 14px);
height: 30px;
position: absolute;
right: 0;
top: 30px;
transform: skew(45deg);
background: red;
background: linear-gradient(90deg, #FF0000, #940202);
}
jsFiddle
I'm trying to get 4 circles within in each other (that don't have a background colour, just a border colour) with text inside the last one using CSS.
Example: http://imgur.com/a/5vUKI
Any idea on how this can be done?
Here you go. This should help you get started.
.circle {
border-radius: 50%;
background: transparent;
border: 2px solid red;
width: 500px;
height: 500px;
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
}
.c2 {
width: 400px;
height: 400px;
border-color: blue;
}
.c3 {
width: 300px;
height: 300px;
border-color: yellow;
}
.c4 {
width: 200px;
height: 200px;
}
<div class="circles">
<div class="circle c1">
<div class="circle c2">
<div class="circle c3">
<div class="circle c4"></div>
</div>
</div>
</div>
</div>
It's a styling, so don't mess with inner HTML code. CSS Gradients can do this well. it's even animatable
.container {
display: inline-block;
height: 12em;
width: 12em;
padding: 4em;
text-align: center;
background: radial-gradient(circle closest-side,
hsla( 0, 80%, 80%, 0) 0%,
hsla( 0, 80%, 80%, 0) 78%,
hsla( 0, 80%, 80%, 1) 79%,
hsla( 0, 80%, 80%, 1) 82%,
hsla( 0, 80%, 80%, 0) 83%,
hsla(100, 80%, 80%, 0) 87%,
hsla(100, 80%, 80%, 1) 88%,
hsla(100, 80%, 80%, 0) 89%,
hsla(200, 80%, 80%, 0) 92%,
hsla(200, 80%, 80%, 1) 93%,
hsla(200, 80%, 80%, 0) 94%,
hsla(300, 80%, 80%, 0) 97%,
hsla(300, 80%, 80%, 1) 98%,
hsla(300, 80%, 80%, 0) 99%
)
;
}
<div class="container">
My inner text is here
</div>
Simply position all the circles on top of each other.
#outer-circle {
border: 1px solid red;
border-radius: 50%;
height: 500px;
width: 500px;
position: relative;
text-align: center;
}
#inner-circle {
position: absolute;
border: 1px solid red;
border-radius: 50%;
height: 480px;
width: 480px;
top: 50%;
left: 50%;
margin: -240px 0px 0px -240px;
}
#inner-circle2 {
position: absolute;
border: 1px solid red;
border-radius: 50%;
height: 460px;
width: 460px;
top: 50%;
left: 50%;
margin: -230px 0px 0px -230px;
}
#inner-circle3 {
position: absolute;
border: 1px solid red;
border-radius: 50%;
height: 440px;
width: 440px;
top: 50%;
left: 50%;
margin: -220px 0px 0px -220px;
}
#text {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
<div id="outer-circle">
<div id="inner-circle">
<div id="inner-circle2">
<div id="inner-circle3">
<div id="text">Breathe out</div>
</div>
</div>
</div>
</div>
Here's my version.
My logic was divided into 2 steps:
Step One :
The .circle-1 is set as relative to be the container of the child's div.
Step Two
The rest of the div's is set as absolute and has a smallest padding that their father, for their parent aways be bigger than the son.
The align in x-axis is set by the left and right as 0 and margin as 0 auto.
The align in y-axis is set by the top:50% and transform:translateY(-50%).
div{
position: absolute;
border: 3px solid;
border-radius: 50%;
width: 150px;
height: 150px;
left:0;
right:0;
top: 50%;
transform: translateY(-50%);
margin:0 auto;
}
.circle-1{
top: 200px;
padding: 40px;
position: relative;
}
.circle-2{
padding: 30px;
border-color: blue;
}
.circle-3{
padding: 20px;
}
.circle-4{
padding: 10px;
}
<div class="circle-1">
<div class="circle-2">
<div class="circle-3">
<div class="circle-4"></div>
</div>
</div>
</div>
Messing around with this as I procrastinated.
Vertically responsive, basic hover effect.
html, body {
display: flex;
justify-content: center;
height: 100vh;
margin: 0;
padding: 0;
background-color: gray;
}
div {
display: flex;
flex-grow: 1;
background-color: hsla(0, 0%, 0%, 0.0);
border-style: solid;
border-color: white;
border-width: 5px;
border-radius: 100%;
padding: 5px;
overflow: hidden;
transition: all 0.1s linear;
box-sizing: border-box;
}
.ring1 {
height: 100vh;
width: calc(100vh);
}
.ring2 {
border-color: royalblue;
}
.ring4 {
justify-content: center;
align-items: center;
text-align: center;
font-size: 28px;
font-variant: small-caps;
font-weight: bold;
color: royalblue;
background-color: salmon;
}
.ring1:hover, .ring1:hover div {
padding: 3px;
font-size: 32px;
border-width: 3px;
}
<div class="ring1">
<div class="ring2">
<div class="ring3">
<div class="ring4">
Breathe Out
</div>
</div>
</div>
</div>
fiddle
https://jsfiddle.net/Hastig/9v4mLdep/
I want to 'cut' my page on two sides, something like this:
http://i.stack.imgur.com/ngZrp.jpg
DEMO: https://jsfiddle.net/r2g0eyxf/3/
#left {
background: url(https://static.pexels.com/photos/24353/pexels-photo.jpg);
width: 50%;
position: absolute;
left: 0px;
height: 100%;
}
#right {
background: url(http://media.caranddriver.com/images/media/51/25-cars-worth-waiting-for-lp-ferrari-488gtb-photo-658256-s-original.jpg);
width: 50%;
position: absolute;
right: 0px;
height: 100%;
}
But:
I need this images responsive
I want to create this 'slash'
How can I do this?
EDIT
This not solving my problem - I need it on full page and without space between images.
An hint would be to use transform and some padding.
average example
body {
margin: 0;
padding: 0;
width:100%;
overflow-x:hidden;
color:turquoise;
text-shadow:0 0 white;
font-size:2em;
}
#left {
position: absolute;
left: -10%;
height: 100%;
}
#left,
#right {
width: 60%;
transform: skew(-15deg);
overflow: hidden;
}
#left .content {
background: url(https://static.pexels.com/photos/24353/pexels-photo.jpg);
height: 100%;
}
#right .content {
height: 100%;
background: url(http://media.caranddriver.com/images/media/51/25-cars-worth-waiting-for-lp-ferrari-488gtb-photo-658256-s-original.jpg);
}
#right {
position: absolute;
right: -10%;
height: 100%;
}
#left .content,
#right .content{
width: 100%;
padding: 0 20%;
margin: 0 -15%;
transform: skew(15deg);
display: flex;
align-items: center;
justify-content: center;
background-size: cover;
}
<div id="left">
<div class="content">Content here</div>
</div>
<div id="right">
<div class="content">Content here</div>
</div>
You could use clip-path, support.
.clipped-img {
position: relative;
}
.clipped-img img {
position: absolute;
width: 50%;
}
.clipped-img img:nth-child(1) {
-webkit-clip-path: polygon( 0% 0, 100% 0, 80% 100%, 0 100% );
clip-path: polygon( 0% 0, 100% 0, 80% 100%, 0 100% );
}
.clipped-img img:nth-child(2) {
right: 10%;
-webkit-clip-path: polygon( 20% 0, 100% 0, 100% 100%, 0 100% );
clip-path: polygon( 20% 0, 100% 0, 100% 100%, 0 100% );
}
<div class="clipped-img">
<img src="http://placehold.it/500x300/FC0/">
<img src="http://placehold.it/500x300/CC0/">
</div>