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>
Related
I created a chat bubble using CSS. But I did not get the output I want. Here is my code,
body{
background-color: lightgreen;
}
.bubble {
margin: 100px;
display: inline-block;
position: relative;
width: 300px;
height: auto;
background-color: white;
}
.border{
border: 2px solid red;
}
.border-radius{
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
}
.triangle-right.border.right-top:before {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: auto;
right: -26px;
top: -2px;
bottom: auto;
border: 25px solid;
border-color: red transparent transparent transparent;
}
.triangle-right.right-top:after{
content: ' ';
position: absolute;
width: 0;
height: 0;
left: auto;
right: -22px;
top: -0.3px;
bottom: auto;
border: 25px solid;
border-color: white transparent transparent transparent;
}
.chat{
padding: 6px;
}
<div class="bubble triangle-right border-radius border right-top">
<div class="chat">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</p>
</div>
</div>
Output I Get:
Output I Want:
How can I get the output in the second picture. I want to get a curve like effect on top right corner (just like in the second image). thanks.
You can try a radial-gradient() to draw the curve :
possible example
body{
background-color: lightgreen;
}
.bubble {
margin: 100px;
display: inline-block;
position: relative;
width: 300px;
height: auto;
background-color: white;
}
.border{
border: 2px solid red;
}
.border-radius{
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
}
.triangle-right.right-top:before{
content: ' ';
position: absolute;
border-top:2px red solid;
width:6px;
top:-2px;
right:0;
height:10px;
background:white;
}
.triangle-right.right-top:after{
content: ' ';
position: absolute;
width: 30px;
height: 40px;
left: auto;
right: -30px;
top: -2px;
background:radial-gradient(ellipse at bottom right, transparent 28px, red 29px , red 30px , white 31px);
border-top:solid red 2px;
}
.chat{
padding: 6px;
}
<div class="bubble triangle-right border-radius border right-top">
<div class="chat">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</p>
</div>
</div>
tweek size and position to your needs.
I'm trying to make some arrows like the following
arrows
I am using Sass and Bootstrap4 and I want to make them by drawing them with css3
I've tried this, but I don't know how to achieve it:
.line1 p{
background-color: red;
width: 80px;
height: 80px;
text-align: center;
align-items: center;
border-radius: 50%;
color: #fff;
font-size: 2rem;
}
.line1 p::before{
content:'';
display: block;
color: blue;
width: 300px;
height: 10px;
position: absolute;
border: 5px solid red;
margin: 30px 10px 0;
z-index: -1;
border-radius: 0 50px 50px 0;
background-color: red;
}
.line1 p::after{
content:'';
display: block;
color: blue;
width: 10px;
height: 200px;
position: absolute;
border: 5px solid red;
margin-left: 20px;
z-index: -1;
background-color: red;
}
<div class="col-md-3 align-items-center mr-0">
<div class="line1 my-auto">
<p class="d-block my-auto">1</p>
</div>
</div>
I come from the future and you managed to do it like this:
.line-container{
border-bottom: 5px solid red;
border-right: 5px dashed red;
}
.line-container::before{
content:"";
// display:block;
position: absolute;
height: 20px;
width:20px;
border-radius:50%;
background: red;
bottom:-7px;
left:0;
}
.line-container::after{
content:"2";
position:absolute;
width:55px;
height:55px;
border-radius:50%;
background: red;
bottom:-25px;
right:-7px;
font-size:2rem;
font-weight:700;
color:#fff;
text-align:center;
}
.line-container p::before{
content:"➤";
position:absolute;
font-size:32px;
color:red;
right:2.6px;
top:-30px;
transform: rotate(270deg);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-8 mt-5">
<div class="line-container px-md-5 pt-5">
<p class="mt-5" >Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dicta minus </p>
</div>
</div>
You only need to use the 'lines' of the rectangles of the containers, they already exist so you only need to put color
I was able to find the initial css for a triangle here. Basically you want to make two borders of a div transparent and give them a certain width so it appears to pinch the div into a triangle. I also added the ball which was pretty straightforward aside from positioning.
You may want to make further adjustments to fit your needs but this should get you started :)
.line1 p{
background-color: red;
width: 80px;
height: 80px;
text-align: center;
align-items: center;
border-radius: 50%;
color: #fff;
font-size: 2rem;
}
.line1 p::before{
content:'';
display: block;
color: blue;
width: 300px;
height: 10px;
position: absolute;
border: 5px solid red;
margin: 30px 10px 0;
z-index: -1;
border-radius: 0 50px 50px 0;
background-color: red;
}
.line1 p::after{
content:'';
display: block;
color: blue;
width: 10px;
height: 200px;
position: absolute;
border: 5px solid red;
margin-left: 20px;
z-index: -1;
background-color: red;
}
.arrow1{
position: absolute;
transform: rotate(180deg);
left: 3px;
top: 225px;
width: 0;
height: 0;
border-right: 28px solid transparent;
border-bottom: 60px solid red;
border-left: 28px solid transparent;
}
.ball1{
position: absolute;
left: 300px;
top: 15px;
background-color: red;
border-radius: 50%;
height: 50px;
width: 50px;
}
<div class="col-md-3 align-items-center mr-0" style="position: relative;">
<div class="line1 my-auto">
<p class="d-block my-auto">1</p>
<div class='arrow1'></div>
<div class='ball1'></div>
</div>
</div>
Well, I'll give you a quick PoC you could easily expand on so its use could be defined for the instance with pre-made templates but if you want all other directions and stuff you'll have to do the extra creative work and fill in the blanks on your own but this might help get you started. Cheers!
.magic-arrows {
position: relative;
display: flex;
align-items: center;
justify-content: center;
height: var(--arrow-circle-height);
width: var(--arrow-circle-width);
background-color: var(--arrow-color);
border-radius: 50%;
overflow: visible;
}
.magic-arrows:before, .magic-arrows:after {
content: '';
display: block;
position: absolute;
color: var(--arrow-color);
border: var(--arrow-color) var(--arrow-dash-size) dashed;
overflow: visible;
z-index: -1;
}
.magic-arrows:before {
height: 0;
width: calc( var(--arrow-circle-width) + var(--arrow-width) );
left: var(--arrow-circle-width);
top: 50%;
transform: translateY(-50%);
}
.magic-arrows:after {
width: 0;
height: calc( var(--arrow-circle-width) + var(--arrow-width) );
top: var(--arrow-circle-width);
left: 50%;
transform: translateX(-50%);
}
.magic-arrows .arrow-right, .magic-arrows .dot-down {
position: absolute;
font-size: var(--arrow-size);
color: var(--arrow-color);
}
.magic-arrows .arrow-right {
top: 50%;
left: calc(var(--arrow-circle-width) + var(--arrow-width) + var(--arrow-size) + 1rem);
transform: translateY(-55%);
}
.magic-arrows .dot-down {
position: absolute;
left: 50%;
top: calc(var(--arrow-circle-width) + var(--arrow-width) + var(--arrow-size) + 1rem);
transform: translateX(-55%) rotate(90deg);
}
<div class="magic-arrows"
style="--arrow-color: red;
--arrow-circle-height: 3rem;
--arrow-circle-width: 3rem;
--arrow-width: 10rem;
--arrow-dash-size: 5px;
--arrow-size: 2rem;">
<span>3</span>
<div class="arrow-right">➤</div>
<div class="dot-down">◉</div>
</div>
I know I can absolute position the pointer of the Tooltip but how can I add the blur effect to the pointer? Because if I put blur effect to it, the blur will not only be shown on the bottom triangle of pointer, but also on the upper half of it.
You can try drop-shadow filter css effect.
.pointer {
width: 200px;
padding: 10px;
position: relative;
filter: drop-shadow(0px 0px 10px #b2b2b2);
background: #fff;
}
.pointer:after {
content: "";
position: absolute;
border: 20px solid;
border-color: #fff transparent transparent;
bottom: -40px;
left: calc(50% - 20px);
}
<div class="pointer">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam convallis interdum cursus.</div>
Check filter cross browser support
Also you can achieve this by using box-shadow and z-index css property. In this you will need to make an extra block to cover the upper part of shadow using :before/:after.
.pointer {
width: 200px;
padding: 10px;
position: relative;
box-shadow: 0px 0px 10px #b2b2b2;
background: #fff;
z-index: 1;
}
.pointer:after {
content: "";
position: absolute;
width: 30px;
height: 30px;
box-shadow: 0px 0px 10px #b2b2b2;
bottom: -15px;
left: calc(50% - 15px);
background: #fff;
transform: rotate(45deg);
z-index: -2;
}
.pointer:before {
content: "";
width: 60px;
height: 30px;
position: absolute;
background: #fff;
left: calc(50% - 30px);
bottom: 0;
z-index: -1;
}
<div class="pointer">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam convallis interdum cursus.</div>
You can use this code
body {
margin: 0;
padding: 0;
}
.example {
background: rgba(219,224,223,0.5);
margin-bottom: 20px;
padding: 20px;
text-align: center;
width: auto;
}
.example-with-box-shadow {
box-shadow: rgba(0,0,0,0.3) 0 2px 10px;
}
.example-with-arrow, .example-with-box-shadow, .example-with-drop-shadow {
background: white;
display: inline-block;
margin-bottom: 5px;
padding: 5px;
position: relative;
width: 200px;
}
.example-with-arrow::after, .example-with-box-shadow::after, .example-with-drop-shadow::after {
border: 10px solid;
border-top-color: currentcolor;
border-right-color: currentcolor;
border-bottom-color: currentcolor;
border-left-color: currentcolor;
border-color: white transparent transparent;
content: "";
left: 50%;
margin-left: -10px;
position: absolute;
top: 100%;
}
<div class="example">
<div class="example-with-box-shadow">Tooltip with box-shadow</div>
</div>
body {
background-color: #888;
}
.triangle {
position: relative;
margin: 3em;
padding: 1em;
box-sizing: border-box;
background: #bada55;
box-shadow: 0px 3px 3px 0 rgba(0, 0, 0, 0.4);
}
.triangle::after{
content: "";
position: absolute;
width: 0;
height: 0;
margin-left: -0.5em;
bottom: -2em;
left: 50%;
box-sizing: border-box;
border: 1em solid black;
border-color: transparent transparent #bada55 #bada55;
transform-origin: 0 0;
transform: rotate(-45deg);
box-shadow: -3px 3px 3px 0 rgba(0, 0, 0, 0.4);
}
<div class="triangle">This is a CSS3 triangle with a proper box-shadow!</div>
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>
This question already has answers here:
CSS triangle custom border color
(5 answers)
Closed 8 years ago.
In my case i have something following this:
http://jsfiddle.net/pyx3zx25/12/
and the question is how can i add the border also to triangle.
My css:
.slide{
position: relative;
padding: 15px;
}
.arrow {
max-width: 300px;
background-color: #E01616;
position: absolute;
top: -10px;
left: -10px;
margin: 5px 0 0 5px;
border: 3px solid black;
}
.arrow:after {
left: 100%;
bottom: 0px;
content: "";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-width: 15px;
border-bottom: 30px solid #E01616;
border-right: 30px solid transparent;
}
Use the :before pseudo-element to create a like-for-like triangle with just a few adjustments, to make it seem like your :after element has a border:
.slide{
position: relative;
padding: 15px;
}
.arrow {
max-width: 300px;
background-color: #E01616;
position: absolute;
top: -10px;
left: -10px;
margin: 5px 0 0 5px;
border: 3px solid black;
}
.arrow:after {
left: 100%;
bottom: 0px;
content: "";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-width: 15px;
border-bottom: 30px solid #E01616;
border-right: 30px solid transparent;
}
.arrow:before {
left: 100%;
bottom: -3px;
content: "";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-width: 15px;
border-bottom: 37px solid #000;
border-right: 37px solid transparent;
}
<div class="slide">
<div class="arrow">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer scelerisque ex eget ultricies blandit.</p>
</div>
</div>
You can't use border because you use it already.
Try it.
UPDTATE
.arrow:before{
border-bottom: 40px solid #000;
border-right: 37px solid transparent;
border-width: 0 37px 40px 0;
bottom: 0;
content: "";
left: 100%;
position: absolute;
top: 55px;
}
jsfiddle - jsfiddle
HTML
<div class="slide">
<div class="arrow">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer scelerisque ex eget ultricies blandit.</p>
</div>
</div>
CSS
.slide{
position: relative;
padding: 15px;
}
.arrow {
max-width: 300px;
background-color: #E01616;
position: absolute;
top: -10px;
left: -10px;
margin: 5px 0 0 5px;
border: 3px solid black;
}
.arrow:after {
left: 100%;
bottom: 0px;
content: "";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-width: 15px;
border-bottom: 30px solid #E01616;
border-right: 30px solid transparent;
box-shadow: 0px 3px 0px 0px #000;
}
.arrow:before{
content: "";
right: -30px;
bottom: 0px;
height: 3px;
width: 30px;
position: absolute;
background: #000;
pointer-events: none;
transform: rotate(45deg) translate(-8px,-11px) scale(1.45);
}