Restyling two adjacent divs with css - html

I am assigned a task to design two divs like this
And here is what I have tried so far, I would like to restyle it with some css.
I would really appreciate any help with the styling. ( It doesn't have to be the same as the given image).
Thank you.
Here are my HTML and CSS code
HTML CODE:
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.container .stage+.stage {
margin-left: 30px;
}
.stage:before {
content: "";
position: absolute;
width: 0;
height: 0;
left: 0;
border-top: 100px solid transparent;
border-left: 10px solid white;
border-bottom: 110px solid transparent;
margin: -10px 0px 0 0px;
}
.stage:after {
color: #4D81BF;
border-left: 20px solid;
border-top: 100px solid transparent;
border-bottom: 100px solid transparent;
display: inline-block;
content: '';
position: absolute;
right: -20px;
top: 0;
}
.stage {
background-color: #4D81BF;
/*width: 150px; */
height: 200px;
line-height: 40px;
display: inline-block;
position: relative;
}
.stage {
color: ;
font-weight: bold;
padding-left: 10px;
font-family: Arial;
font-size: 11;
}
#it,
#isms,
#bul {
color: white;
}
#it {
border: 3px solid white;
background-color: green;
}
#isms,
#bul {
border: 3px solid white;
background-color: orange;
}
<div class="container">
<div class="stage">
<span class="blocktext">Stage Confirm</span>
<div id="it">IT CONFIRM</div>
<div id="isms">ISMS Confirm</div>
</div>
<div class="stage">
<span class="blocktext">Stage Approve</span>
<div id="bul">Bul Approve</div>
</div>
</div>

I believe this will help you. I'd like to clean whole CSS, but didn't want to make to many changes to your original code, so you won't be confused.
.button {
width: 200px;
padding: 0 10px;
box-sizing: border-box;
}
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.container .stage+.stage {
margin-left: 30px;
}
.stage:before {
content: "";
position: absolute;
width: 0;
height: 0;
left: 0;
border-top: 95px solid transparent;
border-left: 70px solid white;
border-bottom: 95px solid transparent;
margin: -20px 0px 0 0px;
}
.stage:after {
color: #4D81BF;
border-left: 70px solid;
border-top: 95px solid transparent;
border-bottom: 95px solid transparent;
display: inline-block;
content: '';
position: absolute;
right: -70px;
top: 0;
}
.stage {
background-color: #4D81BF;
/*width: 150px; */
height: 150px;
line-height: 40px;
display: inline-block;
position: relative;
margin: 20px;
font-weight: bold;
padding: 20px 40px 20px 100px;
font-family: Arial;
font-size: 11;
}
#it,
#isms,
#bul {
color: white;
}
#it {
border: 3px solid white;
background-color: green;
margin: 0 0 10px 0;
}
#isms,
#bul {
border: 3px solid white;
background-color: orange;
}
<div class="container">
<div class="stage">
<span class="blocktext">Stage Confirm</span>
<div id="it" class="button">IT CONFIRM</div>
<div id="isms" class="button">ISMS Confirm</div>
</div>
<div class="stage">
<span class="blocktext">Stage Approve</span>
<div id="bul" class="button">Bul Approve</div>
</div>
</div>

Related

How to make a speech bubble with CSS?

Is it possible to style the following HTML structure to the image shown below with CSS only?
<div class="xyz-dialog">
<div class="title"><span> Tip Title</span></div>
<div class="body"> <span>Description</span></div>
</div>
Required design:
You can do it as below if we can add a container div in the HTML:
.container{
background: gray;
padding: 16px 10px;
width:max-content;
}
.xyz-dialog {
background: white;
padding: 1rem;
border-radius: 8px;
position: relative;
width: 300px;
}
.xyz-dialog::after {
content: "";
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid white;
position: absolute;
top: 100%;
}
.body {
margin-top:8px;
color: gray;
font-size: 15px
}
<div class= "container">
<div class="xyz-dialog">
<div class="title"><span> Tip Title</span></div>
<div class="body"> <span>Description</span></div>
</div>
You can do it as below if we cannot touch the HTML structure:
.xyz-dialog {
padding: 1rem;
border-radius: 8px;
position: relative;
width: 300px;
}
.xyz-dialog::after {
content: "";
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid white;
position: absolute;
top: calc(100% -1rem);
left: 2rem;
}
.xyz-dialog::before {
content: "";
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: gray;
z-index: -1;
}
.title {
padding: 1rem;
background: white;
border-radius: 10px 10px 0 0;
margin: 0 0 -5px 0;
}
.body {
color: gray;
font-size: 15px;
background: white;
margin: 0;
padding: 1rem;
border-radius: 0 0 10px 10px;
}
<div class="xyz-dialog">
<div class="title"><span> Tip Title</span></div>
<div class="body"> <span>Description</span></div>
</div>
You can use after and border.
.xyz-dialog::after{
content: "";
border-top: 12px solid #f1f1f1;
border-right: 8px solid transparent;
border-left: 8px solid transparent;
position: absolute;
bottom: -12px;
left: 4%;
}
.xyz-dialog{
width: 50%;
background: #f1f1f1;
border-radius: 0.3em;
padding: 5px 30px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
box-sizing: border-box;
flex-direction: column;
}
<div class="xyz-dialog">
<div class="title"><span> Tip Title</span></div>
<div class="body"> <span>Description</span></div>
</div>
Little late. Two Boxes. For the small noise you use the css pseudo class after.
body {
background-color: #999;
}
.wrapper {
padding:20px;
}
h3 {
margin:0;
color: #000;
}
.bubble {
position: relative;
background: white;
color: #999;
font-family: Arial;
font-size: 16px;
text-align: left;
width: 250px;
height: 120px;
border-radius: 10px;
padding: 0px;
}
.bubble:after {
content: '';
position: absolute;
display: block;
width: 0;
z-index: 1;
border-style: solid;
border-width: 0 20px 20px 0;
border-color: transparent #fff transparent transparent;
bottom: -16px;
left: 17%;
margin-left: -10px;
}
<div class="bubble">
<div class="wrapper">
<h3>title</h3>
<div>content</div>
</div>
</div>

Double Left and Right Buttons with angled in middle

See this image
Facebook Messenger Android App Buttons ( MESSENGER\ACTIVE )
How can i achieve this ?
in details :-
A div with 2px red border.
that div contains 2 buttons with inline block.
one is on left side and other one is at right side of DIV.
LIKE : [BUTTON1][BUTTON2]
but i want this :- [BUTTON1\BUTTON2]
a Slash style shape between both buttons.
i have tried
#M_Left {
width: 0;
height: 0;
margin: 0 !important;
padding: 0 !important;
display: inline-block;
border-top: 100px solid #3fc2ff;
border-right: 50px solid transparent;
border-left: 400px solid #3fc2ff;
color: #fff;
text-align: center;
}
#M_Right {
width: 0;
height: 0;
margin-left: -40;
border-bottom: 100px solid #3fc2ff;
display: inline-block;
border-right: 400px solid #3fc2ff;
border-left: 50px solid transparent;
color: #fff;
text-align: center !important;
}
.white_M {
margin: 0 !important;
padding: 0 !important;
height: 0 !important;
display: inline-block;
min-width: 400px;
border-width: 0 !important;
border-style: none !important;
color: #3fc2ff !important;
}
.M_Container {
margin: 0 !important;
padding: 0 !important;
width: auto !important;
display: inline-block;
border: 2px solid #3fc2ff;
}
<div class="M_Container">
<div id="M_Left"> HEY</div>
<div id="M_Right" class="white_Mx"> </div>
</div>
Please help me
Thank you in advance
You can create it by using following approach
$('button').click(function() {
$(this).addClass('current').siblings().removeClass('current');
});
.buttonGroup {
display: flex;
border: 1px solid skyblue;
/* Border color change as your need */
overflow: hidden;
border-radius: 5px;
max-width: 350px;
}
button {
flex: 1;
background: none;
border: none;
outline: none;
padding: 5px;
cursor: pointer;
position: relative;
}
button:hover:before {
background: skyblue;
}
button:hover:after {
background: skyblue;
}
button.current:before {
background: skyblue;
}
button.current:after {
background: skyblue;
}
button:before {
content: '';
width: 100%;
height: 100%;
background: #fff;
position: absolute;
transform: skewX(-25deg);
left: -5px;
top: 0;
z-index: -1;
}
button:after {
content: '';
width: 100%;
height: 100%;
background: #fff;
position: absolute;
transform: skewX(-25deg);
right: -5px;
top: 0;
z-index: -1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="buttonGroup">
<button>Hello</button>
<button>Bye</button>
</div>
Try this.
$('button').click(function() {
$('button').removeClass('active');
$(this).addClass('active');
})
.wrap {
white-space: nowrap;
font-size: 0;
border: 2px solid navy;
display: inline-block;
overflow: hidden;
}
button {
border: 0;
background: #fff;
padding: 10px 20px;
position: relative;
outline: 0;
cursor:pointer;
}
button:after,
button:before {
content: '';
position: absolute;
transform: skewX(-25deg);
height: 100%;
width: 10px;
background: #fff;
top: 0;
z-index: 1;
right: 0;
}
button:before {
right: auto;
left: 0;
}
button.active {
background: blue;
color: #fff;
}
button.active:after,
button.active:before {
background: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="wrap">
<button>Button</button>
<button class="active">Active</button>
</div>

How can you create two triangles next to an image?

How can you create two triangles next to an image?
As you can see in the jsfiddle, the triangles are not tounching the image. I want them to touch the image and the blue bar above.
I tried this post: How can I have an image float next to a centered div? didn't work.
.content {
width: 960px;
margin: 0 auto;
}
ul.producten {
margin-top: 4%;
list-style-type: none;
}
ul.producten li {
width: 315px;
}
ul.producten li img {
display: inline-block;
width: 295px;
}
.producten_top {
width: 315px;
height: 40px;
background: #3bcdff;
}
.producten_top h1 {
font-size: 30px;
color: #fff;
text-align: center;
padding: 5px 0;
}
.arrow_left {
display: inline-block;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #1c1c1d;
transform: rotate(225deg);
float: left;
}
.arrow_right {
display: inline-block;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid #1c1c1d;
transform: rotate(315deg);
float: right;
}
<div class="content">
<ul class="producten">
<li>
<div class="producten_top"><h1>Test</h1></div>
<div class="arrow_left"></div>
<img src="http://assets.worldwildlife.org/photos/144/images/hero_small/Giant_Panda_Hero_image_(c)_Michel_Gunther_WWF_Canon.jpg?1345515244" alt="Plafond lampen">
<div class="arrow_right"></div>
</li>
</ul>
</div>
jsfiddle
what it needs to be:
Use position: absolute instead of display: inline-block and give 8px border for triangles instead of 5px and set display: block and margin: auto for make img center. of course you need to set position: relative; for parent (ul.producten li).
.content {
width: 960px;
margin: auto;
}
ul.producten {
margin-top: 4%;
list-style-type: none;
}
ul.producten li {
width: 315px;
position: relative;
}
ul.producten li img {
display: block;
width: 295px;
margin: auto;
}
.producten_top {
width: 315px;
height: 40px;
background: #3bcdff;
}
.producten_top h1 {
font-size: 30px;
color: #fff;
text-align: center;
padding: 5px 0;
}
.arrow_left {
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid #1c1c1d;
transform: rotate(225deg);
position: absolute;
left: 0;
top: 39px;
}
.arrow_right {
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #1c1c1d;
transform: rotate(315deg);
position: absolute;
right: 0;
top: 39px;
}
<div class="content">
<ul class="producten">
<li>
<div class="producten_top"><h1>Test</h1></div>
<div class="arrow_left"></div>
<div class="arrow_right"></div>
<img src="http://assets.worldwildlife.org/photos/144/images/hero_small/Giant_Panda_Hero_image_(c)_Michel_Gunther_WWF_Canon.jpg?1345515244" alt="Plafond lampen">
</li>
</ul>
</div>
This technique makes a square div with a linear gradient alpha background that resembles a triangle. As a bonus, by adjusting the distance between alpha=1 and alpha=0 (the percentages) in the gradients you can change the anti-aliasing of the diagonal line (the left arrow has more anti-aliasing in this example).
.content {
width: 960px;
margin: 0 auto;
}
ul.producten {
margin-top: 4%;
list-style-type: none;
}
ul.producten li {
width: 315px;
position: relative;
}
ul.producten li img {
display: block;
width: 295px;
margin: auto;
}
.producten_top {
width: 315px;
height: 40px;
background: #3bcdff;
}
.producten_top h1 {
font-size: 30px;
color: #fff;
text-align: center;
padding: 5px 0;
}
.arrow_left {
width: 10px;
height: 10px;
background: linear-gradient(225deg, rgba(28,28,29,1) 44%,rgba(28,28,29,0) 56%);
position: absolute;
left: 0;
top: 40px;
}
.arrow_right {
width: 10px;
height: 10px;
background: linear-gradient(135deg, rgba(28,28,29,1) 48%,rgba(28,28,29,0) 50%);
position: absolute;
right: 0;
top: 40px;
}
<div class="content">
<ul class="producten">
<li>
<div class="producten_top"><h1>Test</h1></div>
<div class="arrow_left"></div>
<div class="arrow_right"></div>
<img src="http://assets.worldwildlife.org/photos/144/images/hero_small/Giant_Panda_Hero_image_(c)_Michel_Gunther_WWF_Canon.jpg?1345515244" alt="Plafond lampen">
</li>
</ul>
</div>
I have modified your css. The changes I made are:
Set the same width for the blue header and image
Set position fixed for image and right arrow
Set the arrows degrees values in negative
Check it out...
<html>
<head>
<style>
.content {
width: 960px;
margin: 0 auto;
}
ul.producten {
margin-top: 4%;
list-style-type: none;
}
ul.producten li {
width: 315px;
}
ul.producten li img {
display: inline-block;
width: 315px;
position: fixed;
}
.producten_top {
width: 315px;
height: 40px;
background: #3bcdff;
}
.producten_top h1 {
font-size: 30px;
color: #fff;
text-align: center;
padding: 5px 0;
}
.arrow_left {
display: inline-block;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #1c1c1d;
transform: rotate(-225deg);
float: left;
position: fixed;
}
.arrow_right {
display: inline-block;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid #1c1c1d;
transform: rotate(-315deg);
float: right;
}
</style>
</head>
<body></body>
</html>

CSS: Make border on pure-CSS arrow

I have this code snippet:
.multiply-button {
display: table;
background: rgba(0, 0, 0, 0);
border: none;
color: white;
padding: 0;
}
.multiply-button-content {
display: table-cell;
background: green;
padding: 10px 9px;
border: solid 1px black;
border-right: none !important;
}
.multiply-button-arrow {
display: table-cell;
width: 0px;
height: 0px;
border-style: solid;
border-width: 20px 0 20px 12px;
border-color: transparent transparent transparent green;
}
<button id="multiply-button" class="multiply-button">
<div class="multiply-button-content">Multiply</div>
<div class="multiply-button-arrow"></div>
</button>
I need to make border on this "arrowed" button. I can easily border rectangle part (I've already did it), but how to make this border on triangle part?
The following should do what you need
.multiply-button {
display: table;
background: rgba(0, 0, 0, 0);
border: none;
color: white;
padding: 0;
}
.multiply-button-content {
display: table-cell;
background: green;
padding: 0 9px;
border: solid 1px black;
border-right: none !important;
position: relative;
vertical-align:middle;
height: 40px; /* double the border width */
box-sizing: border-box;
}
.multiply-button-content:after,
.multiply-button-content:before {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-width: 20px 0 20px 12px;
margin-top: -20px;
}
.multiply-button-content:after {
border-color: rgba(0, 128, 0, 0);
border-left-color: #008000;
margin-left: -1px;
}
.multiply-button-content:before {
border-color: rgba(0, 0, 0, 0);
border-left-color: #000000;
}
<button id="multiply-button" class="multiply-button">
<div class="multiply-button-content">Multiply</div>
</button>
This is a useful tool
div{
position: relative;
background-color: #008000;
padding: 0px 16px;
height: 40px;
line-height: 40px;
display: inline-block;
color: white;
border: 2px solid black;
border-right: none;
z-index:1;
}
div:before{
content: '';
position: absolute;
left: 100%;
z-index:-1;
width: 28px;
height: 28px;
background-color: #008000;
border-right: 2px solid black;
border-bottom: 2px solid black;
transform: rotate(-45deg) translate(-14px,-7px);
}
<div>Multiply</div>
Or much simplier :
the CSS with only one pseudo element
.multiply-button {
background: rgba(0, 0, 0, 0);
border: none;
width: 100px;
color: #FFF;
padding: 0;
overflow: hidden;
}
.multiply-button-content {
display: block;
position: relative;
background: #008000;
width: 60px;
padding: 10px 9px;
border: solid 1px #000;
border-right: none !important;
}
.multiply-button-content:before {
content: "";
position: absolute;
width: 36px;
height: 31px;
z-index: -1;
top: 0;
right: -13px;
border: 1px solid #000;
background: #008000;
transform: rotate(45deg);
}
<button id="multiply-button" class="multiply-button">
<div class="multiply-button-content">Multiply</div>
</button>
Since it only takes one pseudo element to make the 'point', you could use the other to make a border behind it (making it slightly bigger in size).
For example;
div {
height: 30px;
border: 2px solid black;
display: inline-block;
border-right: 2px solid transparent;
line-height: 30px;
text-align: center;
position: relative;
background: tomato;
color: white;
}
div:before {
content: "";
position: absolute;
border: 17px solid transparent;
border-left: 17px solid black;
right: -35px;
top: -2px;
z-index: 6;
}
div:after {
content: "";
position: absolute;
border: 15px solid transparent;
border-left: 15px solid tomato;
right: -31px;
top: 0;
z-index: 8;
}
<div>Arrow, Please!</div>
You can achieve that with :before or :after pseudo selectors. Study and adjust the example below.
.multiply-button {
display: inline;
background: rgba(0, 0, 0, 0);
border: none;
color: white;
padding: 0;
position: realtive;
}
.multiply-button-content {
display: table-cell;
background: green;
padding: 10px 9px;
border: solid 1px black;
border-right: none !important;
width: 100px;
position: relative;
}
.multiply-button-arrow {
width: 0;
height: 0px;
border-style: solid;
border-width: 20px 0 20px 12px;
border-color: transparent transparent transparent black;
position: absolute;
top: -2px;
right:-12px;
}
.multiply-button-arrow:before {
border-style: solid;
border-width: 20px 0 20px 12px;
border-color: transparent transparent transparent green;
position: absolute;
right: 1px;
top: -20px;
content: "";
}
<button id="multiply-button" class="multiply-button">
<div class="multiply-button-content">
<div class="multiply-button-arrow"></div>
Multiply</div>
</button>

Styling border around div

I'm a bit stuck on styling border around div box.
The problem is that I can't make borders not to be like:
Here is the real example what I have:
.num.num_1 {
border-left-color: #0D2431;
}
.num {
width: 60px;
height: 60px;
line-height: 50px;
border-width: 5px;
font-size: 40px;
}
.num {
float: left;
width: 40px;
height: 40px;
line-height: 36px;
text-align: center;
border: 2px solid #eee;
font-size: 20px;
color: #0D2431;
background-color: #fff;
}
div {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
}
<div class="num num_1">1</div>
.num.cheat:before {
content:"";
position: absolute;
left: -5px;
right: -5px;
top: -5px;
bottom: -5px;
}
.num_1:before {
border-left: 5px solid black;
}
.num_2:before {
border-left: 5px solid black;
border-top: 5px solid black;
}
.num_3:before {
border-left: 5px solid black;
border-top: 5px solid black;
border-right: 5px solid black;
}
.num_4:before {
border-left: 5px solid black;
border-top: 5px solid black;
border-right: 5px solid black;
border-bottom: 5px solid black;
}
.num {
width: 60px;
height: 60px;
line-height: 50px;
border-width: 5px;
font-size: 40px;
position: relative;
margin-right: 10px;
}
.num {
float: left;
width: 40px;
height: 40px;
line-height: 36px;
text-align: center;
border: 5px solid #eee;
font-size: 20px;
color: #0D2431;
background-color: #fff;
}
div {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
}
<div class="num num_1 cheat">1</div>
<div class="num num_2 cheat">2</div>
<div class="num num_3 cheat">3</div>
<div class="num num_4 cheat">4</div>
I modified your css a little bit. I solved it using the :before pseudo element.
Better yet, you can use box-shadow to achieve this without any extra elements.
See: http://jsfiddle.net/w3b1uh7g/2/
.num {
border-left: 0px;
box-shadow: -5px 0 0 0 #0D2431;
}
You can do a weird series of nested divs:
.border {
background: green;
padding: 10px 10px 10px 0;
display: inline-block;
}
.border-left {
padding-left: 10px;
background: black;
display: inline-block;
}
.inside-box {
background: red;
height: 100px;
width: 100px;
}
<div class="border-left">
<div class="border">
<div class="inside-box">1</div>
</div>
</div>
Just add these to your css. the Pseudo Elements should make it square without adding extra divs in the HTML
.num.num_1:before {
content: "";
position: relative;
display: block;
top: -5px;
left: -5px;
height: 5px;
width: 5px;
background: black;
}
.num.num_1:after {
content: "";
position: relative;
display: block;
bottom: 0px;
left: -5px;
height: 5px;
width: 5px;
background: black;
}