Double Left and Right Buttons with angled in middle - html

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>

Related

Restyling two adjacent divs with css

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>

How to remove blue highlight color in dropdown foundation 5?

I'm currently creating dropdown menu that will toggle to the right of sidebar. I want to remove the blue color around the dropdown menu. I'm using Foundation 5 to create the dropdown menu.
Here is the screenshot of dropdown that I've made
Below are CSS and HTML code that I used
.f-dropdown1 {
display: none;
left: -9999px;
list-style: none;
margin-left: 0;
position: absolute;
background: #FFFFFF;
border: solid 1px #cccccc;
font-size: 0.875rem;
height: auto;
max-height: none;
width: 100%;
z-index: 89;
margin-top: 2px;
max-width: 200px;
}
.f-dropdown1.open {
display: block;
}
.f-dropdown1>*:first-child {
margin-top: 0;
}
.f-dropdown1>*:last-child {
margin-bottom: 0;
}
.f-dropdown1:before {
border: inset 6px;
content: "";
display: block;
height: 0;
width: 0;
border-color: transparent transparent #FFFFFF transparent;
border-bottom-style: solid;
position: absolute;
top: -12px;
left: 10px;
z-index: 89;
}
.f-dropdown1:after {
border: inset 7px;
content: "";
display: block;
height: 0;
width: 0;
border-color: transparent transparent #cccccc transparent;
border-bottom-style: solid;
position: absolute;
top: -14px;
left: 9px;
z-index: 88;
}
.f-dropdown1.right:before {
left: auto;
right: 10px;
}
.f-dropdown1.right:after {
left: auto;
right: 9px;
}
.f-dropdown1.drop-right {
display: none;
left: -9999px;
list-style: none;
margin-left: 0;
/* position: absolute;
*/
background: #FFFFFF;
border: solid 1px #cccccc;
font-size: 0.875rem;
height: auto;
max-height: none;
width: 100%;
z-index: 89;
margin-top: 0;
margin-left: 65px;
max-width: 200px;
}
.f-dropdown1.drop-right.open {
display: block;
}
.f-dropdown1.drop-right>*:first-child {
margin-top: 0;
}
.f-dropdown1.drop-right>*:last-child {
margin-bottom: 0;
}
.f-dropdown1.drop-right:before {
border: inset 6px;
content: "";
display: block;
height: 0;
width: 0;
border-color: transparent #FFFFFF transparent transparent;
border-right-style: solid;
position: absolute;
top: 10px;
left: -12px;
z-index: 89;
}
.f-dropdown1.drop-right:after {
border: inset 7px;
content: "";
display: block;
height: 0;
width: 0;
border-color: transparent #cccccc transparent transparent;
border-right-style: solid;
position: absolute;
top: 9px;
left: -14px;
z-index: 88;
}
.f-dropdown1 ul:active {
border: 1px solid red !important;
}
.f-dropdown1 li {
cursor: pointer;
font-size: 0.875rem;
line-height: 1.125rem;
margin: 0;
}
.f-dropdown1 li:hover, .f-dropdown li:focus {
background: #EEEEEE;
border: none;
}
.f-dropdown1 li a {
display: block;
padding: 0.5rem;
color: #555555;
}
.f-dropdown1.content {
display: none;
left: -9999px;
list-style: none;
margin-left: 0;
position: absolute;
background: #FFFFFF;
border: solid 1px #cccccc;
font-size: 0.875rem;
height: auto;
max-height: none;
padding: 1.25rem;
width: 100%;
z-index: 89;
max-width: 200px;
}
.f-dropdown1.content.open {
display: block;
}
.f-dropdown1.content>*:first-child {
margin-top: 0;
}
.f-dropdown1.content>*:last-child {
margin-bottom: 0;
}
.f-dropdown1.radius {
border-radius: 3px;
}
.f-dropdown1.tiny {
max-width: 200px;
}
.f-dropdown1.small {
max-width: 300px;
}
.f-dropdown1.medium {
max-width: 500px;
}
.f-dropdown1.large {
max-width: 800px;
}
.f-dropdown1.mega {
width: 100% !important;
max-width: 100% !important;
}
.f-dropdown1.mega.open {
left: 0 !important;
}
.dropdown.button, button.dropdown {
position: relative;
padding-right: 3.5625rem;
}
.dropdown.button::after, button.dropdown::after {
border-color: #FFFFFF transparent transparent transparent;
border-style: solid;
content: "";
display: block;
height: 0;
position: absolute;
top: 50%;
width: 0;
}
.dropdown.button::after, button.dropdown::after {
border-width: 0.375rem;
right: 1.40625rem;
margin-top: -0.15625rem;
}
.dropdown.button::after, button.dropdown::after {
border-color: #FFFFFF transparent transparent transparent;
}
.dropdown.button.tiny, button.dropdown.tiny {
padding-right: 2.625rem;
}
.dropdown.button.tiny:after, button.dropdown.tiny:after {
border-width: 0.375rem;
right: 1.125rem;
margin-top: -0.125rem;
}
.dropdown.button.tiny::after, button.dropdown.tiny::after {
border-color: #FFFFFF transparent transparent transparent;
}
.dropdown.button.small, button.dropdown.small {
padding-right: 3.0625rem;
}
.dropdown.button.small::after, button.dropdown.small::after {
border-width: 0.4375rem;
right: 1.3125rem;
margin-top: -0.15625rem;
}
.dropdown.button.small::after, button.dropdown.small::after {
border-color: #FFFFFF transparent transparent transparent;
}
.dropdown.button.large, button.dropdown.large {
padding-right: 3.625rem;
}
.dropdown.button.large::after, button.dropdown.large::after {
border-width: 0.3125rem;
right: 1.71875rem;
margin-top: -0.15625rem;
}
.dropdown.button.large::after, button.dropdown.large::after {
border-color: #FFFFFF transparent transparent transparent;
}
.dropdown.button.secondary:after, button.dropdown.secondary:after {
border-color: #333333 transparent transparent transparent;
}
<a data-options="align:right" data-dropdown="drop1" aria-controls="drop1" aria-expanded="false" href="#" class="left"><i class="fa fa-bell-o" aria-hidden="true"></i></a>
<ul id="drop1" class="f-dropdown1" data-dropdown-content aria-hidden="true" tabindex="-1">
<li>This is a link</li>
<li>This is another</li>
<li>Yet another</li>
</ul>
Either customise the scss defaults Foundation provides or override them with your own css file.
More in their documentation here.
If you aren't running SASS then you'll need your overrides stylesheet to come AFTER the Foundation one so you don't need to do silly things like use !important.
In the example in the documentation their trigger is a button with the "button" class so you need to override that class to get the look you want:
<a class="button" data-dropdown="tinyDrop" aria-controls="tinyDrop" aria-expanded="false">Link Dropdown ยป</a>
Personally I'd add something like this to override rather than changing the default .button style:
.button.my-dropdown-style {...}
.f-dropdown1 {
outline: none;
}

how to add border in an arrow before a div?

I have this box with an arrow:
#div1 {
position: fixed;
width: 140px;
min-height: 100px;
max-height: 400px;
background: #fff;
color: #000;
border: 1px solid #ccc;
//border-top:none;
z-index: 3000;
}
#div1:before {
content: "";
vertical-align: middle;
margin: auto;
position: absolute;
left: 0;
right: 0;
bottom: 100%;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #fff;
}
<div id=div1></div>
I want the arrow to have the same border as #div1 (1px solid #ccc) but it is white.
Any ideas how can I add a border color in the arrow?
JSFiddle
#div1 {
position: relative;
width: 140px;
min-height:100px;
max-height:400px;
background: #fff;
color: #000;
border:1px solid #ccc;
z-index:3000;
margin: 3rem;
}
#div1:before {
content: "";
vertical-align: middle;
margin: auto;
position: absolute;
display: block;
left: 0;
right: 0;
bottom: calc(100% - 6px);
width: 12px;
height: 12px;
transform: rotate(45deg);
border: 1px solid;
border-color: #ccc transparent transparent #ccc;
background-color: white;
}
<div id=div1></div>
I've modified your code a bit, but I think I've got your desired output
FIDDLE
#div1 {
position: fixed;
width: 140px;
min-height: 100px;
max-height: 400px;
background: #fff;
color: #000;
border: 1px solid #ccc;
}
#div1:before {
content: '';
vertical-align: middle;
margin: auto;
position: absolute;
left: 0;
right: 0;
bottom: 93%;
width: 15px;
height: 15px;
background: #fff;
border-top: 1px solid #ccc;
border-right: 1px solid #ccc;
transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
<br>
<div id="div1"></div>

Create a down arrow pointer

How can I create a down arrow for parent in css so it would look like a speech bubble?
This is what I tried.
<div class="parent">TEST
<span class="tri">TEST</span>
</div>
.tri {
opacity: 0;
}
.tri:before {
position: absolute;
top: 40%;
left: 50%;
margin-top: -15px;
margin-left: -100px;
background-color: #FFF;
color: #000;
text-align: center;
padding: 10px;
min-width: 200px;
}
.tri:after {
border-top: 5px solid #000;
border-top: 5px solid #000;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
}
.parent:hover .tri:before, .parent:hover .tri:after {
opacity: 1;
}
Fiddle
You are missing 2 things here :
content:''; for the pseudos
show the parent pseudo
:before,
:after {
content: '';
}
.parent:hover .tri,
.parent:hover .tri:before,
.parent:hover .tri:after {
opacity: 1;
}
:before,
:after {
content: '';
}
.parent:hover .tri,
.parent:hover .tri:before,
.parent:hover .tri:after {
opacity: 1;
}
.tri {
opacity: 0;
}
.tri:before {
position: absolute;
top: 40%;
left: 50%;
margin-top: -15px;
margin-left: -100px;
background-color: #FFF;
color: #000;
text-align: center;
padding: 10px;
min-width: 200px;
}
.tri:after {
border-top: 5px solid #000;
border-top: 5px solid #000;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
}
<div class="parent">TEST
<span class="tri">TEST</span>
</div>
https://fiddle.jshell.net/0h05kbsd/3/
you could also spare some code using an unicode character like \25bc:
a:hover:after {
content:'\25bc';
}
<a href> link to hover to show a down-arrow</a>
unicode ressource among others : http://unicode-table.com/en/sets/arrows-symbols/
Like this?
.tri {
opacity: 1;
display: block;
}
.tri:after {
content: '';
display: inline-block; width: 10px; height: 10px;
margin: -5px 0 0 10px; padding: 0;
border: 5px solid #000;
border-width: 0 3px 3px 0;
background: transparent;
transform: rotate(45deg);
}
Make an angle with two borders and then rotate it 45 degrees or where ever you need it to point to. Important: a :after or :before pseudo element always needs a content: '' property, even it just an empty string. Otherwise the pseudo element will not show.
More elaborate examples of entire speech bubbles are easily found, this fiddle, for example.
You can use clip-path as an alternate for the border shape ,
div:before {
content: '';
position: absolute;
display: block;
left: -20px;
top: 6px;
width: 20px;
height: 20px;
background-color: #888;
-webkit-clip-path: polygon(0 50%, 100% 0 , 100% 100%)
}
div {
width: 150px;
height: 50px;
background-color: #999;
margin-left: 40px;
border-radius: 4px;
position: relative;
}
div:before {
content: '';
position: absolute;
display: block;
left: -20px;
top: 6px;
width: 20px;
height: 20px;
background-color: #999;
-webkit-clip-path: polygon(0 50%, 100% 0 , 100% 100%)
}
<div></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>