positioning in firefox and google chrome not matching up - html

The first image is how it looks (correctly) in google chrome, the second image is how it looks (incorrectly) in firefox.
Any tips that might help me resolve this in firefox? Thank you.
<div class="container">
<div id="top">
<div class="top-bar">
<div id="logo"></div>
<div class="top-bar-red-stripe">
<ul class="top-bar-social-btns">
<li>facebook</li>
<li>facebook</li>
</ul>
</div>
</div><!-- /.top-bar -->
<div id="top-left-content">
<h3>This is a title</h3>
<div class="race-drivers"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam</p>
</div>
<div id="video-content">
<h3>LATEST WEBISODE</h3>
<div class="video-file"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing</p>
View all webisodes
</div>
<div id="vote-content">
<h3>VOTE FOR WHAT HAPPENS NEXT</h3>
<div class="vote-bar">
Enhancements
Compass
Activities
Vote
</div>
</div><!-- #vote-content -->
</div><!-- /#top -->
</div><!-- /.container -->
.container {
width: 960px;
margin: 0 auto;
border: #outside-border;
#top {
background: #000 url('../images/top_background.jpg') no-repeat;
height: 505px;
#video-content {
position: absolute;
margin: 0;
padding: 0;
top: 85px;
right: 239px;
border: 1px solid red;
width: 500px;
h3 {
margin: 0;
}
p {
margin: 0;
}
.video-file {
position: absolute;
background: #ccc;
border: 2px solid #3592cd;
width: 400px;
height: 240px;
}// .video-file
a.all-webisodes-btn:link, a.all-webisodes-btn:visited {
display: inline-block;
overflow: hidden;
text-indent: -9999px;
background: transparent url('../images/all-webisodes-btn.png') no-repeat;
width: 88px;
height: 65px;
position: absolute;
top: 107px;
right: -2px;
}// .all-webisodes-btn
}// #video-content
#vote-content {
width: 442px;
position: absolute;
top: 328px;
right: -523px;
position: relative;
h3 {
margin: 0 0 0 15px;
}
.vote-bar {
position: relative;
//border:1px solid red;
background: transparent url('../images/vote-bar-bg.png') no-repeat;
width: 438px;
height: 73px;
position: relative;
a:link, a:visited {
display: inline-block;
overflow: hidden;
text-indent: -9999px;
}
a.vote-enhancements:link, a.vote-enhancements:visited {
background: transparent url('../images/enhancements_btn.png') no-repeat;
width: 86px;
height: 42px;
position: relative;
top: 10px;
left: 170px;
}
a.vote-compass:link, a.vote-compass:visited {
background: transparent url('../images/compass_btn.png') no-repeat;
width: 52px;
height: 42px;
position: relative;
top: 10px;
left: 190px;
}
a.vote-activities:link, a.vote-activities:visited {
background: transparent url('../images/activities_btn.png') no-repeat;
width: 56px;
height: 42px;
position: relative;
top: 10px;
left: 210px;
}
a.vote-btn:link, a.vote-btn:visited {
background: transparent url('../images/vote-now-btn.png') no-repeat;
width: 141px;
height: 34px;
position: relative;
top: 47px;
left: 73px;
}
}// .vote-bar
}// .vote-content
}// #top
}// .container
UPDATE: fixed, set position to relative for #video-content and set position to absolute for children elements
#video-content {
width: 500px;
position: relative;
top: 10px;
left: 459px;
h3 {
margin: 0;
}
.video-file {
position: absolute;
background: #ccc;
border: 2px solid #3592cd;
width: 400px;
height: 240px;
}// .video-file
a.all-webisodes-btn:link, a.all-webisodes-btn:visited {
display: inline-block;
overflow: hidden;
text-indent: -9999px;
background: transparent url('../images/all-webisodes-btn.png') no-repeat;
width: 88px;
height: 65px;
position: absolute;
top: 100px;
right: -3px;
}// .all-webisodes-btn
}// #video-content

It looks like the #video-content element might have margin in Firefox. That should be removed before absolute positioning elements.
Try this at the beginning of your CSS:
* { margin: 0; padding: 0px; }

Related

How to adapt my custom multimedia video controls - HTML5/CSS3?

I am creating a design of controls to personalize the reproduction of videos, having some errors in the design there is a disorder in the design and even more when it comes to visualizing in different type of responsive screen.
In the design of the Speed as I can order them with a drop-down menu as shown in the following example image:
How can I give the correct style to the progress bar similar to the following image:
And carry an adaptive order similar to it.
My code complete:
.seeker {
position: relative;
width: 54%;
margin: 0 1%;
display: inline-block;
margin-right: 5px;
margin: 0 10px;
}
.trackbar {
position: absolute;
width: 100%;
height: 1px;
top: 12px;
z-index: -2;
background: rgba(255,255,255,0.7);
}
.progressbar {
position: absolute;
left: 0;
top: 12px;
width: 0;
height: 1px;
border: 0;
background-color: red;
color: red;
z-index: 0;
pointer-events: none;
}
.content-video-player {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 40px;
/*background: -webkit-linear-gradient(left,rgba(0,0,0,.7) 0px,rgba(0,0,0,.7) 95px,transparent 95px,transparent 98px,rgba(0,0,0,.7) 98px);*/
background: rgba(0,0,0,.7);
-webkit-transition: bottom .4s ease-in;
}
.content-video-player div.btn {
width: 95px;
text-align: center;
float: left;
}
.btnPlay::after {
content: "";
background-image: url(http://svgshare.com/i/3um.svg);
width: 50px;
height: 50px;
display: inline-block;
background-size: cover;
position: relative;
top: -7px;
}
.btnStop::after {
content: "";
background-image: url(http://svgshare.com/i/3vz.svg);
width: 65px;
height: 65px;
display: inline-block;
background-size: cover;
position: relative;
top: -7px;
}
.video-time-player {
float: right;
color: #ccc;
text-align: center;
width: 15%;
}
.volume {
position: relative;
cursor: pointer;
width: 70px;
height: 10px;
float: right;
margin-top: 10px;
margin-right: 10px;
}
.volumeBar {
display: block;
height: 30%;
position: absolute;
top: 0;
left: 0;
background-color: #a4c9ec;
z-index: 10;
}
.sound, .btnFS {
border: none;
float: right;
}
.sound::after {
content: "";
background-image: url(http://svgshare.com/i/3v6.svg);
width: 45px;
height: 40px;
display: inline-block;
background-size: cover;
position: relative;
top: -4px;
}
.btnFS::after {
content: "";
background-image: url(http://svgshare.com/i/3u5.svg);
width: 25px;
height: 25px;
display: inline-block;
background-size: cover;
position: relative;
top: 6px;
}
<!-- Container of the controls vidio players -->
<div class="content-video-player">
<div class="btnPlay btn" title="Play/Pause video"></div>
<div class="btnStop btn" title="Stop video"></div>
<div class="spdText btn">Speed: </div>
<div class="btnx1 btn text selected" title="Normal speed">x1</div>
<div class="btnx3 btn text" title="Fast forward x3">x3</div>
<div id="seeker" class="seeker">
<div class="trackbar"></div>
<div id="progressbar" class="progressbar" style="width: 114.7px;">
<span class="bufferBar"></span>
<span class="timeBar"></span>
</div>
<div class="video-time-player">
<span class="current">00:03</span> /
<span class="duration">00:03</span>
</div>
</div>
<div class="btnFS" title="Switch to full screen"></div>
<div class="volume" title="Set volume">
<span class="volumeBar" style="width: 84.2857%;"></span>
</div>
<div class="sound sound2" title="Mute/Unmute sound"></div>
</div>
The player layout is mainly 3 components (display: inline-table) within .content-video-player (display:table):
.playbackComponent | .timeComponent | .modComponent
▶ ] [ ⏸ ] [ X ] |_____ 07:22/15:01 | 🔉||||||| ⛶
The controls in each of the components have display:table-cell for a stable linear layout and position:absolute for finer grain adjustments. Included is a menu to adjust playbackRate, just hover over the 3rd button from the left X
Demo
*,
*::after,
*::before {
margin: 0;
padding: 0;
border: 0 none rgba(0, 0, 0, 0);
}
body {
overflow-y: scroll;
}
.content-video-player>* {
display: inline-table;
}
.content-video-player {
position: relative;
transform: translateY(68vh);
left: 0;
width: 100%;
height: 40px !important;
background: rgba(0, 0, 0, .7);
transition: bottom .4s ease-in;
display: table;
table-layout: fixed;
}
.seeker {
position: absolute;
width: 30%;
display: table-cell;
margin: 0 5px;
top: calc(50% - 6px);
left: 100px;
}
.trackbar {
position: absolute;
width: 100%;
height: 1px;
top: 12px;
z-index: -2;
background: rgba(255, 255, 255, 0.7);
}
.progressbar {
position: absolute;
left: 0;
top: 12px;
width: 0;
height: 1px;
border: 0;
background-color: red;
color: red;
z-index: 0;
pointer-events: none;
}
.content-video-player button.btn {
width: 48px;
text-align: center;
background-color: rgba(0, 0, 0, 0);
display: table-cell;
}
.btnPlay::after {
content: "";
background-image: url(http://svgshare.com/i/3um.svg);
width: 48px;
height: 48px;
display: table-cell;
background-size: cover;
position: absolute;
top: -4px;
}
.btnStop::after {
content: "";
background-image: url(http://svgshare.com/i/3vz.svg);
width: 56px;
height: 56px;
display: table-cell;
background-size: cover;
position: absolute;
left: 25px;
top: calc(50% - 28px);
}
.btnSpd {
transform: translateX(-35px);
height: 48px;
width: 48px;
font-size: 24px;
top: calc(50% - 24px);
}
.video-time-player {
position: absolute;
color: #ccc;
text-align: center;
left: 11.5em;
font-size: .3em;
width: auto;
min-width: 90px;
}
.video-time-player>* {
display: inline-block;
}
.volume {
position: relative;
cursor: pointer;
width: 80px;
height: 10px;
right: -5em;
top: 17px;
}
.volumeBar {
display: block;
height: 30%;
position: absolute;
background-color: #a4c9ec;
z-index: 10;
}
.sound,
.btnFS {
border: none;
}
.sound::after {
content: "";
background-image: url(http://svgshare.com/i/3v6.svg);
width: 45px;
height: 40px;
display: table-cell;
background-size: cover;
position: absolute;
top: 4px;
left: 25.5em;
}
.btnFS::after {
content: "";
background-image: url(http://svgshare.com/i/3u5.svg);
width: 25px;
height: 25px;
right: 5px;
display: table-cell;
background-size: cover;
position: absolute;
top: 12px;
}
.speed {
display: none;
position: absolute;
max-height: 0;
transition: max-height 1s;
}
.speed:hover,
.btnSpd:hover .speed {
display: inline-table;
list-style: none;
max-height: 300px;
transition: max-height 1s;
top: -170px;
}
.cmp {
width: 30%
}
<!-- Container of the controls vidio players -->
<main class='content-video-player'>
<section class="cmp playbackComponent" style='display:inline-table'>
<button class="btnPlay btn" title="Play/Pause video"></button>
<button class="btnStop btn" title="Stop video"></button>
<button class="btnSpd btn">X
<ul class='speed'>
<li>x3.0</li>
<li>x2.5</li>
<li>x2.0</li>
<li>x1.5</li>
<li>x1.0</li>
<li>x0.5</li>
</ul>
</button>
</section>
<section class='cmp timeComponent' style='display:inline-table'>
<div id="seeker" class="seeker">
<div class="trackbar"></div>
<div id="progressbar" class="progressbar" style="width: 114.7px;">
<span class="bufferBar"></span>
<span class="timeBar"></span>
</div>
<time class="video-time-player">
<b class="current">00:03</b> /
<b class="duration">00:03</b>
</time>
</div>
</section>
<section id='cmp ModComponent' style='display:inline-table'>
<div class="volume" title="Set volume">
<span class="volumeBar" style="width: 84.2857%;"></span>
</div>
<button class="btn sound sound2" title="Mute/Unmute sound"></button>
<button class="btn btnFS" title="Switch to full screen"></button>
</section>
</main>

How to stop an element from appearing outside it's parent division?

I have a division with class "centre" inside another division called "parallaxOne". With my css, if I view it in my laptop, it is showing the divisions properly, but if I view it in a mobile phone, the "centre" division is appearing outside the "parallaxOne" division, and in other browsers, it is appearing in front of the text. Why is this happening, and how do I correct it? Here is my code:
.centre {
position: absolute;
top: 75%;
left: 50%;
transform: translateY(-15%);
width: 0;
height: 140px;
border-left: 6px dashed #0079a5;
}
.arrow {
position: absolute;
top: 0;
left: -6px;
height: 40px;
width: 6px;
background: #007;
animation: animate 2s infinite;
}
.arrow:before {
content: '';
position: absolute;
bottom: 0;
left: -10px;
width: 20px;
height: 20px;
border-bottom: 6px solid #007;
border-right: 6px solid #007;
transform: rotate(45deg);
}
#keyframes animate {
0% {
transform: translateY(0);
opacity: 0.5;
}
50% {
transform: translateY(70px);
opacity: 1;
}
100% {
transform: translateY(140px);
opacity: 0;
}
}
.container {
max-width: inherit;
margin: 0 auto;
background-color: white;
font-size: 24px;
padding: 25px;
}
.parallaxOne {
background: /*url(images/parallax3.jpg); This is an image in my computer*/yellow;
text-align: center;
height: 450px;
padding: 2%;
margin: 2% 0;
}
.parallaxOne h6 {
color: black;
font-size: 200%;
margin: 8% 30%;
padding-top: 100px;
z-index: -1;
}
.parallaxTwo {
background: /*url('images/parallax2.jpg') no-repeat center; This is an image in my computer*/green;
background-size: cover;
background-attachment: fixed;
text-align: center;
height: 600px;
padding: 2%;
}
<html>
<head>
<title>My website</title>
</head>
<body>
<header>
<h1>My website</h1>
</header>
<div class="container">
<div class="parallaxOne">
<h3>Welcome to my website!</h3>
<div class="centre">
<div class="arrow"></div>
</div>
</div>
<div class="parallaxTwo">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</div>
</div>
</body>
</html
I'm sorry for the long code, but I edited it as much as I could to reproduce the same problem.
Use this tag in your head section for responsive scaling your contents
<meta name="viewport" content="width=device-width, initial-scale=1">

How can I skew the middle part of my div box

I am using skew in order to achieve the same design as the one in the photo but I could only get it right for the top part.
How can I do something like this:
you can also see on my codepen here
section#products {
background-image: url("https://www.oceana-residence.com/wp-content/uploads/2016/09/3-min-2.jpg");
background-size: cover;
background-position: top center;
background-repeat: no-repeat;
color: white;
position: relative;
h3 {
font-family: 'Titillium Web';
line-height: 1.2;
font-weight: bold;
font-size: 28px;
text-transform: uppercase;
}
div.products_box {
overflow: auto;
width: 100%;
&>div {
opacity: 0.8;
max-width: 50%;
width: 100%;
height: 450px;
display: flex;
}
.box {
width: 100%;
display: flex;
align-items: center;
.flex {
max-width: 420px;
}
}
.products_left {
background: #2b2b2b;
float: left;
text-align: right;
.fa {
font-size: 100px;
}
.box {
justify-content: flex-end;
padding-right: 50px;
}
.content {}
.left_box {
padding-left: 40px;
}
}
.products_right {
float: right;
background: #d27473;
.box {
justify-content: inital;
padding-left: 50px;
}
.flex {
padding-right: 40px;
}
.fa {
font-size: 170px;
}
}
}
}
.anchor_top {
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 10px solid white;
position: absolute;
left: 49.2%;
top: 0px;
z-index: 1;
}
.anchor_bottom_left {
width: 0;
height: 0;
border-left: 15px solid transparent;
/*border-right: 15px solid transparent;*/
border-top: 10px solid grey;
position: absolute;
left: 49.2%;
bootom: 0px;
z-index: 1;
}
.anchor_bottom_right {
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 10px solid green;
position: absolute;
left: 49.2%;
bootom: 0px;
z-index: 1;
}
<section id="products">
<div class="anchor_top"></div>
<div class="products_box">
<div class="products_left">
<div class="box">
<div class="content flex">
</div>
<div class="left_box">
<div class="flex">
<i class="fa fa-cogs" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
<div class="products_right">
<div class="box">
<div class="flex">
<i class="fa fa-mobile" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
<div class="anchor_bottom_left"></div>
<div class="anchor_bottom_right"></div>
</section>
You can achieve this using :before and :after pseudo-elements.
You can have a container element <div class="image-container image-container-col-2"> and multiple children <div class="image-container-split">.
.image-container-col-2 was added in order to mark that the container will be split in two. Therefore this solution can be adapted to more columns. Or even more, use existing CSS libraries like Bootstrap own column system and adapt that.
The following code is long and, if you are using SCSS for example, you can easily parameterize this in order to be more readable.
SOLUTION 1: content on multiple columns but not on main container
p {
font-size: 1.1em;
font-family: Arial;
color: #fff;
}
.image-container {
position: relative;
width: 500px;
height: 331px;
}
.image-container.image-container-col-2 .image-container-split {
width: 50%;
}
.image-container:before {
content: '';
position: absolute;
z-index: -2;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: url(http://az616578.vo.msecnd.net/files/2016/04/09/6359580807140768861266757027_Never-Study-Hard-The-Art-of-Studying-Smart.jpg);
background-repeat: none;
background-size: cover;
}
.image-container-split {
position: relative;
height: 100%;
float: left;
box-sizing: border-box;
border: 20px solid transparent;
border-bottom-color: #fff;
text-align: center;
/* Flexbox - use this to align items inside your container */
display: flex;
justify-content: center;
align-items: center;
flex-flow: wrap column;
}
.image-container-split:first-child {
border-left: none;
}
.image-container-split:last-child {
border-right: none;
}
.image-container-split:nth-child(odd) {
padding-left: 20px;
}
.image-container-split:nth-child(even) {
padding-right: 20px;
}
.image-container-split:after {
content: '';
position: absolute;
top: -20px;
border: 10px solid #fff;
border-bottom-color: transparent;
}
.image-container-split:nth-child(odd):after {
right: -20px;
border-left-color: transparent;
}
.image-container-split:nth-child(even):after {
left: -20px;
border-right-color: transparent;
}
.image-container-split:before {
content: '';
position: absolute;
z-index: -1;
top: -20px;
right: 0;
left: 0;
bottom: -20px;
border: 20px solid transparent;
border-bottom-color: #fff;
opacity: 0.5;
}
.image-container-split:first-child:before {
border-left: none;
}
.image-container-split:last-child:before {
border-right: none;
}
.image-container-split:nth-child(odd):before {
background-color: red;
right: -20px;
}
.image-container-split:nth-child(even):before {
background-color: blue;
left: -20px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div class="image-container image-container-col-2">
<div class="image-container-split">
<p>This is some content and some more and more and more and more </p>
<p>This is some content</p>
<p>This is some content</p>
</div>
<div class="image-container-split">
<p>This is some content and some more and more and more and more </p>
<p>This is some content</p>
<p>This is some content</p>
</div>
</div>
</body>
</html>
SOLUTION 2: content on multiple columns as well as on main container
Content is placed on main container and on separate two columns (notice the smileys).
p {
font-size: 1.1em;
font-family: Arial;
color: #fff;
}
.image-container-split p {
font-size: 3em;
}
.image-container {
position: relative;
width: 500px;
height: 331px;
padding: 40px 20px;
box-sizing: border-box;
text-align: center;
/* Flexbox - use this to align content */
display: flex;
flex-flow: wrap column;
align-items: center;
justify-content: center;
}
.image-container.image-container-col-2 .image-container-split:nth-child(odd) {
left: 0;
right: 50%;
}
.image-container.image-container-col-2 .image-container-split:nth-child(even) {
left: 50%;
right: 0;
}
.image-container:before {
content: '';
position: absolute;
z-index: -4;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: url(http://az616578.vo.msecnd.net/files/2016/04/09/6359580807140768861266757027_Never-Study-Hard-The-Art-of-Studying-Smart.jpg);
background-repeat: none;
background-size: cover;
}
.image-container-split {
position: absolute;
z-index: -3;
top: 0;
bottom: 0;
box-sizing: border-box;
border: 20px solid transparent;
border-bottom-color: #fff;
padding-bottom: 20px;
/* Flexbox - use this to align content */
display: flex;
flex-direction: wrap column;
align-items: center;
justify-content: center;
}
.image-container-split:first-child {
border-left: none;
padding-left: 20px;
}
.image-container-split:last-child {
border-right: none;
padding-right: 20px;
}
.image-container-split:before {
content: '';
position: absolute;
z-index: -1;
top: -20px;
border: 10px solid #fff;
border-bottom-color: transparent;
}
.image-container-split:nth-child(odd):before {
right: -20px;
border-left-color: transparent;
}
.image-container-split:nth-child(even):before {
left: -20px;
border-right-color: transparent;
}
.image-container-split:after {
content: '';
position: absolute;
z-index: -3;
top: -20px;
left: 0;
right: 0;
bottom: -20px;
opacity: 0.5;
border: 20px solid transparent;
border-bottom-color: #fff;
}
.image-container-split:first-child:after {
border-left: none;
}
.image-container-split:last-child:after {
border-right: none;
}
.image-container-split:nth-child(odd):after {
background-color: red;
right: -20px;
}
.image-container-split:nth-child(even):after {
background-color: blue;
left: -20px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div class="image-container image-container-col-2">
<p>This is some content and some more and more and more and more </p>
<p>This is some content</p>
<p>This is some content</p>
<div class="image-container-split-container">
<div class="image-container-split">
<p>☺</p>
</div>
<div class="image-container-split">
<p>☺</p>
</div>
</div>
</div>
</body>
</html>
Container with triangles only
If there needs to be container with some triangles then the following can be achieved:
The size of the image is 500 x 331.
:before - is creating the top triangle
:after + background image - is creating the bottom triangle
.image-container has a smaller height than the image in order to use that remaining part to be added to the bottom triangle
p {
font-size: 1.1em;
font-family: Arial;
color: #fff;
}
.image-container-split p {
font-size: 3em;
}
.image-container {
position: relative;
width: 500px;
height: 311px;
padding: 20px;
box-sizing: border-box;
text-align: center;
background-image: url(http://az616578.vo.msecnd.net/files/2016/04/09/6359580807140768861266757027_Never-Study-Hard-The-Art-of-Studying-Smart.jpg);
background-repeat: no-repeat;
background-size: 500px 331px;
/* Flexbox - use this to align content */
display: flex;
flex-flow: wrap column;
align-items: center;
justify-content: center;
}
.image-container:before {
content: '';
position: absolute;
top: 0;
border: 20px solid transparent;
border-top-color: #fff;
}
.image-container:after {
content: '';
left: 50%;
transform: translateX(-20px);
bottom: -40px;
position: absolute;
border: 20px solid #fff;
border-top: 20px solid transparent;
background-image: url(http://az616578.vo.msecnd.net/files/2016/04/09/6359580807140768861266757027_Never-Study-Hard-The-Art-of-Studying-Smart.jpg);
background-size: 500px 331px;
background-repeat: no-repeat;
background-position: center bottom;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div class="image-container">
<p>This is some content and some more and more and more and more </p>
<p>This is some content</p>
<p>This is some content</p>
</div>
</body>
</html>
Just few changes, complete your goal:
.anchor_top {
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 10px solid white;
position: absolute;
left: 48.9%; //change here
top: 0px;
z-index: 1;
}
For bottom part :
.anchor_bottom_left {
width: 0;
height: 0;
border-left: 15px solid transparent;
border-top: 10px solid grey;
position: absolute;
left: 48.9%; //change here
z-index: 1;
}
.anchor_bottom_right {
width: 0;
height: 0;
border-right: 15px solid transparent;
border-top: 10px solid #d98d8e;
position: absolute;
left: 50%; //change here and remove border-left
z-index: 1;
}
One option would be to work with pseudo-classes + transform:skewX.
/* Using pseudo-classes + transform skewX */
.products_box:before,
.products_box:after {
content: '';
display: block;
width: 50%;
position: absolute;
bottom: 0;
height: 15px;
background: white;
transform: skewX(50deg);
z-index: 2;
}
.products_box:before {
left: -10px;
}
.products_box:after {
right: -10px;
transform: skewX(-50deg);
}
See full snippet below.
section#products {
background-image: url("https://www.oceana-residence.com/wp-content/uploads/2016/09/3-min-2.jpg");
background-size: cover;
background-position: top center;
background-repeat: no-repeat;
color: white;
position: relative;
}
section#products h3 {
font-family: 'Titillium Web';
line-height: 1.2;
font-weight: bold;
font-size: 28px;
text-transform: uppercase;
}
section#products div.products_box {
overflow: auto;
width: 100%;
}
section#products div.products_box > div {
opacity: 0.8;
max-width: 50%;
width: 100%;
height: 450px;
display: flex;
}
section#products div.products_box .box {
width: 100%;
display: flex;
align-items: center;
}
section#products div.products_box .box .flex {
max-width: 420px;
}
section#products div.products_box .products_left {
background: #2b2b2b;
float: left;
text-align: right;
}
section#products div.products_box .products_left .fa {
font-size: 100px;
}
section#products div.products_box .products_left .box {
justify-content: flex-end;
padding-right: 50px;
}
section#products div.products_box .products_left .left_box {
padding-left: 40px;
}
section#products div.products_box .products_right {
float: right;
background: #d27473;
}
section#products div.products_box .products_right .box {
justify-content: inital;
padding-left: 50px;
}
section#products div.products_box .products_right .flex {
padding-right: 40px;
}
section#products div.products_box .products_right .fa {
font-size: 170px;
}
.anchor_top {
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 10px solid white;
position: absolute;
left: 49.2%;
top: 0px;
z-index: 1;
}
/*
.anchor_bottom_left{
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 10px solid grey;
position: absolute;
left: 49.2%;
bootom: 0px;
z-index: 1;
}
.anchor_bottom_right{
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 10px solid green;
position: absolute;
left: 49.2%;
bootom: 0px;
z-index: 1;
}
*/
/* Using pseudo-classes + transform skewX */
.products_box:before,
.products_box:after {
content: '';
display: block;
width: 50%;
position: absolute;
bottom: 0;
height: 15px;
background: white;
transform: skewX(50deg);
z-index: 2;
}
.products_box:before {
left: -10px;
}
.products_box:after {
right: -10px;
transform: skewX(-50deg);
}
<section id="products">
<div class="anchor_top"></div>
<div class="products_box">
<div class="products_left">
<div class="box">
<div class="content flex">
<section id="black-studio-tinymce-10" class="widget-1 widget-first widget-last widget-odd widget widget_black_studio_tinymce"><div class="textwidget"><h3>Importance of Business</h3>
<h3>Intelligence Technology</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris congue nisi eget justo rutrum, ut pellentesque nulla posuere. Etiam vitae fringilla massa. Aenean sit amet tellus ex.</p>
</div></section> </div>
<div class="left_box">
<div class="flex">
<i class="fa fa-cogs" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
<div class="products_right">
<!-- about_widget here -->
<div class="box">
<div class="flex">
<i class="fa fa-mobile" aria-hidden="true"></i>
</div>
<div class="content flex">
<section id="black-studio-tinymce-9" class="widget-1 widget-first widget-last widget-odd widget widget_black_studio_tinymce"><div class="textwidget"><h3>Improving Mobile</h3>
<h3>Banking Experience</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris congue nisi eget justo rutrum, ut pellentesque nulla posuere. Etiam vitae fringilla massa. Aenean sit amet tellus ex.</p>
</div></section> </div>
</div>
</div>
</div>
<div class="anchor_bottom_left"></div>
<div class="anchor_bottom_right"></div>
</section>

div with right arrow

I have this div:
I need css that do exacly that, the div and the arrow to the right like that.
Alos, i need a random text (length is changing, and we are talking responsive) in it and i want the text always to be in the middle of things... what is the best way to do so?
Here's a great generator to get you started and then you can customize it a little more to get your desired result
http://cssarrowplease.com/
To get something similar to what you showed, try
.arrow_box {
position: relative;
background: #3abc3d;
min-height: 80px;
border-radius: 10px;
padding: 20px;
}
.arrow_box:after {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(58, 188, 61, 0);
border-left-color: #3abc3d;
border-width: 20px;
margin-top: -20px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<div class="col-xs-5 col-sm-4 col-md-4 col-lg-2">
<div class="arrow_box">
Message for everything
</div>
</div>
And on your arrow box, using bootstrap or whatever grid system you are using, attach the sizing for responsiveness.
Example 1
.block {
background: green;
border-radius: 10px;
padding: 20px;
position: relative;
color: #fff;
max-width: 200px;
margin: 0 auto;
}
.block:after {
content: '';
position: absolute; right: -20px; top: 50%;
border: 10px solid transparent;
border-left: 10px solid green;
-webkit-transform: translate(0,-50%);
-ms-transform: translate(0,-50%);
transform: translate(0,-50%);
}
<div class="block">
Block
</div>
Example 2
.block {
background: green;
border-radius: 10px;
padding: 20px;
position: relative;
color: #fff;
max-width: 200px;
margin: 0 auto;
}
.block:after{
content: '';
position: absolute; right: -10px; top: 50%;
background: green;
width: 20px; height: 20px;
margin-top: -10px;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
}
<div class="block">
Block
</div>
Something like this,
Reference
<style>
.arrow-right {
width: 0;
height: 0;
border-top: 60px solid transparent;
border-bottom: 60px solid transparent;
border-left: 60px solid green;
}
</style>
<div class="arrow-right"></div>
Please try this
.box {
width: 200px;
padding: 10px;
background: green;
border-radius: 5px;
position: relative;
}
.box p {
margin: 0;
color: #fff;
}
.box::after {
position: absolute;
content: "";
border-style: solid;
border-width: 20px;
border-color: transparent transparent transparent green;
left: 100%;
top: 50%;
margin-top: -20px;
}
<div class="box">
<p>orem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque in fermentum risus. Donec malesuada, risus id vulputate varius, diam enim elementum sem.</p>
</div>

Need help creating slated or angled divs CSS/HTML

I need help creating responsive divs with background images that have a slant or angle in them with no border to achvive a look like this:
http://jsfiddle.net/b4zjs60k/
<div class="rr-left">
</div>
<div class="rr-right">
</div>
I have tried using background images with this solution, the only problem is the angled borders are color and if I add a background image to that it looks all messed up.
I've seen this one: http://codepen.io/jefflupinski/pen/azvsA but the only problem with the skew is that I need to have the left and right sides to be straight
So i was wondering if anyone has found a solution to make both divs touch and have responsive backgrounds or combine both in a way to incorporate images
thanks hopefully this makes sense
Try the method below and adjust as needed.
#holder {
height: auto;
width: auto;
float: left;
overflow: hidden;
font-family: calibri;
background-color: white;
position: relative;
}
#holder .content {
display: inline-block;
width: 45%;
text-align: center;
position: relative;
color: white;
cursor: pointer;
background: #2c3e50;
margin-left: 0;
z-index: 2;
}
#holder .content:hover {
background-color: #425160;
}
.content:hover .line {
background: #425160!important;
}
#holder .line {
-ms-transform: rotate(10deg);
/* IE 9 */
-webkit-transform: rotate(10deg);
/* Chrome, Safari, Opera */
transform: rotate(10deg);
border-left: solid 1px white;
position: absolute;
right: 89%;
display: block;
width: 40px;
background: inherit;
height: 250px;
bottom: -10px;
z-index: -1;
}
p,
h3 {
padding: 0 30px 0 30px;
text-align: left;
width: 70%;
}
h3 {
font-size: 24px;
line-height: 24px;
margin-bottom: 0;
}
<div id="holder">
<div class="content">
<h3>This is a header</h3>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr.</p>
</div>
<div class="content">
<div class="line"></div>
<h3>This is a header</h3>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr.</p>
</div>
</div>
<!-- End Holder -->
Here is my answer, using skew, but in a container that has overflow hidden
.header {
width: 100%;
height: 0%;
padding-bottom: 25%;
position: relative;
overflow: hidden;
}
.left {
width: 60%;
height: 100%;
position: absolute;
right: 50%;
top: 0px;
transform: skew(-20deg);
overflow: hidden;}
.right {
width: 60%;
height: 100%;
position: absolute;
left: 50%;
top: 0px;
transform: skew(-20deg);
overflow: hidden;
}
.innerleft {
content: "";
position: absolute;
width: 100%;
height: 100%;
background-image: url(http://placekitten.com/800/400);
transform: skew(20deg);
left: 10%;
background-size: cover;
}
.leftcontent {
position: absolute;
left: 100px;
top: 60px;
color: white;
font-size: 40px;
}
.right:after {
content: "";
position: absolute;
width: 100%;
height: 100%;
background-image: url(http://placekitten.com/600/500);
transform: skew(20deg);
right: 10%;
background-size: cover;
}
<div class="header">
<div class="left">
<div class="innerleft">
<div class="leftcontent">LEFT</div>
</div>
</div>
<div class="right"></div>
</div>