Can't remove italic text from collapsible content - html

I don't even any experiencing programming, but I am trying to put together a FAQ section for our help site and I wanted to use collapsible sections for the Q&A. I made it mostly work as I wanted, however, there is one thing I can't change at all. I have looked around and could not find what is wrong with the code. Any help would be highly appreciated. I really never did this before, so a total newbie here x
The HTML code I am using is:
<link rel="stylesheet" type="text/css" href="https://content.ilabsolutions.com/wp-content/uploads/2020/05/gradifi.css" media="screen">
<div class="wrap-collabsible">
<input id="collapsible" class="toggle" type="checkbox" value="on">
<label class="lbl-toggle" for="collapsible">Question?</label>
<div class="collapsible-content">
<div class="content-inner">
<p>Answer.</p>
</div></div></div>
</html>
input[type='checkbox'] {
display: none;
}
.wrap-collabsible {
font-style: normal;
line-height: normal;
}
.lbl-toggle {
display: block;
text-transform: none;
text-align: left;
width: 100%;
font-family: arial, sans-serif;
font-size: 1.2rem;
font-style: normal;
padding: 0.6rem;
color: #ffff;
background: linear-gradient(to right, #00A9E0, #0085D5);
cursor: pointer;
border-radius: 5px 5px 0px 0px;
transition: all 0.25s ease-out;
}
.lbl-toggle:hover {
color: #7C5A0B;
}
.lbl-toggle::before {
content: ' ';
display: inline-block;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid currentColor;
vertical-align: middle;
margin-right: .7rem;
transform: translateY(-2px);
transition: transform .2s ease-out;
}
.collapsible-content .content-inner {
background: linear-gradient(to right, #f7f7f7, #f5f5f5);
border-bottom: 1px solid rgba(250, 250, 250);
border-bottom-left-radius: 7px;
border-bottom-right-radius: 7px;
padding: .5rem 1rem;
border-radius: 0px 0px 5px 5px;
font-family: arial, sans-serif;
}
.collapsible-content {
max-height: 0px;
overflow: hidden;
transition: max-height .25s ease-in-out;
}
.toggle:checked+.lbl-toggle+.collapsible-content {
max-height: 100%;
}
.toggle:checked+.lbl-toggle::before {
transform: rotate(90deg) translateX(-3px);
}
.toggle:checked+.lbl-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
This is how the browsers displays it, the blue box text in Italic.
Update:
I am not sure if this is the way to post the resolution, but I finally figured it.
Under .lbl-toggle { instead of using text-transform: none !important; I used font-style: normal; !important . That did the trick! Thanks everyone!

Hello William,
Please give this code a try and let me know the outcome, buddy. I certainly hope this help you solving this issue, mate!
input[type='checkbox'] {
display: none;
}
.wrap-collabsible {
font-style: normal;
line-height: normal;
}
.lbl-toggle {
display: block;
text-transform: none !important;
font-style: normal !important;
text-align: left;
width: 100%;
font-family: arial, sans-serif;
font-size: 1.2rem;
font-style: normal;
padding: 0.6rem;
color: #ffff;
background: linear-gradient(to right, #00A9E0, #0085D5);
cursor: pointer;
border-radius: 5px 5px 0px 0px;
transition: all 0.25s ease-out;
}
.lbl-toggle:hover {
color: #e3a514;
}
.lbl-toggle::before {
content: ' ';
display: inline-block;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid currentColor;
vertical-align: middle;
margin-right: .7rem;
font-style: normal !important;
transform: translateY(-2px);
transition: transform .2s ease-out;
}
.collapsible-content .content-inner {
background: linear-gradient(to right, #f7f7f7, #f5f5f5);
border-bottom: 1px solid rgba(250, 250, 250);
border-bottom-left-radius: 7px;
border-bottom-right-radius: 7px;
padding: .5rem 1rem;
border-radius: 0px 0px 5px 5px;
font-family: arial, sans-serif;
}
.collapsible-content {
max-height: 0px;
overflow: hidden;
transition: max-height .25s ease-in-out;
}
.toggle:checked+.lbl-toggle+.collapsible-content {
max-height: 100%;
}
.toggle:checked+.lbl-toggle::before {
transform: rotate(90deg) translateX(-3px);
}
.toggle:checked+.lbl-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
<html>
<head>
<title>No</title>
<link rel="stylesheet" type="text/css" href="https://content.ilabsolutions.com/wp-content/uploads/2020/05/gradifi.css" media="screen">
</head>
<body>
<div class="wrap-collabsible">
<input id="collapsible" class="toggle" type="checkbox" value="on">
<label class="lbl-toggle" for="collapsible">Question?</label>
<div class="collapsible-content">
<div class="content-inner">
<p>Answer.</p>
</div></div></div>
</body>
</html>

Related

jQuery toggle moves the bottom element

I have boxes with some content but not all text is displayed. On click I toggle all the text but the problem is I don't want the bottom element to move, instead I want the toggled div to be on top of the bottom element. Would anyone help with ideas how to do this? Thank you.
Ps. Also, for some reason the transition/animation doesn't work.
Here is a link to codepen: https://codepen.io/christmastrex/pen/gOwGvap and here is my code:
<div class="card">
<div class="card__header js-toggle">
<p class="card__title">“It’s not about weight it’s about how<br> your body changes”</p>
</div>
<div class="card__toggle">
<p>Doing resistance training and cardio combined and I have not lost one single ounce on the scale….I was feeling horribly frustrated being it has been a month so I decided to do a progress sequence and wth look at me now!! It’s not about weight, it’s about how your body changes when you eat right and exercise! Yay!!”</p>
</div>
</div>
<div class="card">
<div class="card__header js-toggle">
<p class="card__title">“It’s not about weight it’s about how<br> your body changes”</p>
</div>
<div class="card__toggle">
<p>Doing resistance training and cardio combined and I have not lost one single ounce on the scale….I was feeling horribly frustrated being it has been a month so I decided to do a progress sequence and wth look at me now!! It’s not about weight, it’s about how your body changes when you eat right and exercise! Yay!!”</p>
</div>
</div>
------------------------------------------------------------
.card {
background-color: #fff;
max-width: 490px;
padding: 20px;
margin-bottom: 30px;
border-radius: 5px;
position: relative;
box-sizing: border-box;
box-shadow: 0 3px 30px 0 rgba(74,74,74,.3);
&__toggle {
overflow: hidden;
max-height: 55px;
p {
font-size: 16px;
margin-bottom: 10px;
}
}
&__title {
font-weight: 900;
margin-bottom: 5px;
}
&__header {
position: relative;
cursor: pointer;
&::after{
content: "\f078";
font-family: "Font Awesome 5 Pro";
font-weight: 400;
display: inline-block;
background-color: #d54f80;
border: 2px solid #d54f80;
color: #fff;
width: 30px;
height: 30px;
border-radius: 15px;
font-size: 14px;
text-align: center;
line-height: 2;
position: absolute;
top: 0;
right: 0;
transition: all .3s ease-in-out;
}
}
&.active {
.card__toggle {
max-height: 700px;
transition: all .3s ease-in-out;
}
.card__header {
&::after {
background-color: #fff;
color: red;
transform: rotate(180deg);
}
}
}
}
-----------------------------------------------------
$(document).ready(function() {
$(".js-toggle").on("click", function () {
$(".card__header.active").not($(this)).removeClass("active").next(".js-card-toggle").slideUp("slow");
$(this).toggleClass("active").next(".js-card-toggle").slideToggle("slow");
$(this).closest(".card").toggleClass("active").siblings().removeClass("active");
});
});```
I think you are trying to achieve this, copy it and see if it works.
HTML:
<div class="card">
<div class="card__header js-toggle">
<p class="card__title">
“It’s not about weight it’s about how<br />
your body changes”
</p>
</div>
<div class="card__toggle">
<p>
Doing resistance training and cardio combined and I have not lost one
single ounce on the scale….I was feeling horribly frustrated being it has
been a month so I decided to do a progress sequence and wth look at me
now!! It’s not about weight, it’s about how your body changes when you eat
right and exercise! Yay!!”
</p>
</div>
</div>
<div class="card">
<div class="card__header js-toggle">
<p class="card__title">
“It’s not about weight it’s about how<br />
your body changes”
</p>
</div>
<div class="card__toggle">
Doing resistance training and cardio combined and I have not lost one single
ounce on the scale….I was feeling horribly frustrated being it has been a
month so I decided to do a progress sequence and wth look at me now!! It’s
not about weight, it’s about how your body changes when you eat right and
exercise! Yay!!”
</div>
</div>
SCSS:
.
card {
max-height: 125px;
overflow: hidden;
background-color: #fff;
max-width: 490px;
padding: 20px;
margin-bottom: 30px;
border-radius: 5px;
position: relative;
height: 150px;
box-sizing: border-box;
box-shadow: 0 3px 30px 0 rgba(74, 74, 74, 0.3);
transition: 0.4s ease;
&.active {
max-height: 210px;
}
&__toggle {
background-color: white;
p {
font-size: 16px;
margin-bottom: 10px;
}
}
&__title {
font-weight: 900;
margin-bottom: 5px;
}
&__header {
position: relative;
cursor: pointer;
&::after {
content: "\f078";
font-family: "Font Awesome 5 Pro";
font-weight: 400;
display: inline-block;
background-color: #d54f80;
border: 2px solid #d54f80;
color: #fff;
width: 30px;
height: 30px;
border-radius: 15px;
font-size: 14px;
text-align: center;
line-height: 2;
position: absolute;
top: 0;
right: 0;
transition: all 0.3s ease-in-out;
}
}
&.active {
.card__toggle {
transition: all 0.3s ease-in-out;
width: 100%;
z-index: 1;
background-color: white;
}
.card__header {
&::after {
background-color: #fff;
color: red;
transform: rotate(180deg);
}
}
}
}
jQuery:
$(".js-toggle").click(function () {
console.log($(this).parents(".card"));
$(this).parents(".card").toggleClass("active");
});
I managed to do find a solution after all.. I made changes to the css only
background-color: #fff;
max-width: 490px;
padding: 20px;
margin: 0 auto 70px auto;
border-radius: 5px;
position: relative;
box-sizing: border-box;
box-shadow: 0 3px 30px 0 rgba(74, 74, 74, 0.3);
&::after {
content: "";
position: absolute;
height: 20px;
background-color: #fff;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
bottom: -40px;
left: 0;
z-index: 10;
width: 100%;
box-shadow: 0 10px 20px -7px rgba(74, 74, 74, 0.3);
transition: all 0.3s ease-in-out;
transition-delay: 0.5s;
}
&__toggle {
overflow: hidden;
max-height: 45px;
position: absolute;
z-index: 1;
background-color: #fff;
margin-left: -20px;
padding-left: 20px;
padding-right: 20px;
border-radius: 5px;
box-shadow: 0 10px 15px -12px rgba(74, 74, 74, 0.3);
transition: all 1s ease-in-out;
p {
font-size: 16px;
margin-bottom: 20px;
line-height: 1.3;
}
&-s {
max-height: 18px;
}
}
&--s {
max-width: 350px;
}
&__img {
border: 5px solid #d54f80;
border-radius: 5px;
padding: 5px 5px 1px 5px;
margin-bottom: 20px;
}
&__title {
font-weight: 900;
margin-bottom: 5px;
}
&__header {
position: relative;
cursor: pointer;
&::after {
content: "\f078";
font-family: "Font Awesome 5 Pro";
font-weight: 400;
display: inline-block;
background-color: #d54f80;
border: 2px solid #d54f80;
color: #fff;
width: 30px;
height: 30px;
border-radius: 15px;
font-size: 14px;
text-align: center;
line-height: 2;
position: absolute;
top: 0;
right: 0;
transition: all 0.3s ease-in-out;
}
}
&.active {
&.card::after {
background-color: transparent;
transition: all 0s ease-in-out;
}
.card__toggle {
max-height: 700px;
}
.card__header {
&::after {
background-color: #fff;
color: pink;
transform: rotate(180deg);
}
}
}
}

Creating Custom designed Upload file Button

I want to create a custom button for a file upload in a form using simple html and css.
Here is my code.
.upload-btn-wrapper {
position: relative;
overflow: hidden;
display: inline-block;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="upload-btn-wrapper">
<button class="btn">Upload a file<i style="font-size:18px" class="fa"></i></button>
<input type="file" name="myfile" />
</div>
if it is just about to design upload button cutomly then this css code is also usefull.
Here is your css
and open the snippet to check.
.upload_field input.wpcf7-file::-webkit-file-upload-button {
border: none;
color: #fff;
font-weight: 500;
background: linear-gradient(90deg, rgba(35,90,75,8) 0%, rgb(33, 169, 99) 35%, rgba(39,203,119,1) 100%);
padding: 4px 18px;
border-radius: 30px;
cursor: pointer;
box-shadow: 2px 1px 9px -3px #25c171;
}
.upload_field input.wpcf7-file::-webkit-file-upload-button:hover {
background: linear-gradient(90deg, rgba(39,203,119,1) 0%, rgba(39,203,119,1) 35%, rgba(14,90,51,1) 100%);
}
.upload_field input.wpcf7-file::-webkit-file-upload-button:focus{
outline:none;
}
.upload_field input.wpcf7-file:focus {
outline: none;
}
.upload_field {
margin-bottom: 20px;
padding-left: 5px;
border: 1px solid #e6e6e6;
padding: 15px 10px 25px;
border-radius: 20px;
}
<div class="upload_field">
<label>Please Upload Your Resume(jpg,png, pdf, doc).<br>
<span class="wpcf7-form-control-wrap file-874"><input type="file" name="file-874" size="40" class="wpcf7-form-control wpcf7-file" accept=".jpg,.png,.pdf,.doc" aria-invalid="false"></span></label>
</div>
.upload-btn-wrapper {
position: relative;
overflow: hidden;
display: inline-block;
}
.fa {
margin-left: 10px;
padding: 10px;
background: white;
color : #0e5a33;
border-radius: 50%;
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.btn {
border: 2px solid #0e5a33;
background-color: #0e5a33;
box-shadow: 8px 8px 18px 0px rgba(84, 181, 119, 0.3) !important;
font-size: 18px;
padding: 5px 5px 5px 28px;
border-radius: 25px;
color: white;
}
.btn:before{
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
opacity: 1;
-webkit-transform: translate(-105%, 0);
transform: translate(-105%, 0);
background-color: rgba(255, 255, 255, 0.8);
}
.btn:hover:before{
opacity: 0;
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
.upload-btn-wrapper input[type=file] {
font-size: 100px;
position: absolute;
left: 0;
top: 0;
opacity: 0;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="upload-btn-wrapper">
<button class="btn">Upload a file<i style="font-size:18px" class="fa"></i></button>
<input type="file" name="myfile" />
</div>
<!DOCTYPE html>
<html>
<head>
<style>
.button {
display: inline-block;
border-radius: 4px;
background-color: #f4511e;
border: none;
color: #FFFFFF;
text-align: center;
font-size: 28px;
padding: 20px;
width: 200px;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
</style>
</head>
<body>
<h2>Animated Button</h2>
<button class="button" style="vertical-align:middle"><span>Upload File </span>
</button>
</body>
</html>

Dropdown menu fades in, but doesn't fade out

I've coded a dropdown menu with HTML and CSS, and I can sucessfully have it fade in when the user's mouse hovers over the button in the menu. However, when the mouse leaves the dropdown, the dropdown doesn't fade out, it just disappears? I believe this is a syntax error but I'm not sure where. How can I make the dropdown fade out just like I made it fade in?
.top-block-container {
float: left;
width: 50%;
margin: 0.5% 0.25%;
}
.top-block-container:hover .top-block-dropdown {
visibility: visible;
opacity: 1;
transform: translateY(0);
height: auto;
}
.top-block {
width: 100%;
font-family: Lato;
font-weight: 900;
text-align: center;
padding: 10px 0;
border-radius: 50px;
font-size: 25px;
transition: background-color 0.25s linear, box-shadow 0.25s linear;
float: left;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
box-shadow: 0 0 5px black;
margin: 0;
}
.top-block:hover {
cursor: pointer;
box-shadow: 0 0 15px black;
}
.top-block-dropdown {
width: 100%;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
float: left;
margin-top: 7.5px;
border-radius: 25px;
box-shadow: 0 0 15px black;
visibility: hidden;
opacity: 0;
height: 0;
transform: translateY(-2em);
transition: visibility 0s, transform 0.25s, opacity 0.25s linear;
}
.dropdown-option-heading {
font-family: Lato;
font-weight: 700;
margin: 5px 0 0 0;
padding: 5px 10px;
border-bottom: 2px solid white;
}
.dropdown-option {
font-family: Lato;
font-weight: 400;
text-align: center;
border-bottom: 1px solid white;
margin: 0;
padding: 5px 10px;
transition: box-shadow 0.25s linear;
}
.dropdown-option:hover {
background: linear-gradient(to top, dodgerblue, #00B0FF);
cursor: pointer;
}
.last-option {
border: 0;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
<div class="top-block-container">
<h1 class="top-block">ECWMF</h1>
<div class="top-block-dropdown">
<p class="dropdown-option-heading">Global Models</p>
<p class="dropdown-option">GFS</p>
<p class="dropdown-option">ECMWF</p>
<p class="dropdown-option">CMC</p>
<p class="dropdown-option">NAVGEM</p>
<p class="dropdown-option">UKMET</p>
<p class="dropdown-option-heading">Mesoscale Models</p>
<p class="dropdown-option">HRRR</p>
<p class="dropdown-option">HWRF</p>
<p class="dropdown-option">NAM 32km</p>
<p class="dropdown-option">NAM 12km</p>
<p class="dropdown-option">RAP</p>
<p class="dropdown-option">SREF</p>
<p class="dropdown-option last-option">HIRESW</p>
</div>
</div>
Your CSS transition says for the div's visibility to change in zero seconds:
.top-block-dropdown { transition: visibility 0s ... }
So the div disappears instantly. You just need a longer transition time.
Because your transition has visibility 0s. Give that a non-zero value and the visibility transitions. Or just remove visibility from all of those definitions. opacity will suffice.
.top-block-container {
float: left;
width: 50%;
margin: 0.5% 0.25%;
}
.top-block-container:hover .top-block-dropdown {
opacity: 1;
transform: translateY(0);
height: auto;
}
.top-block {
width: 100%;
font-family: Lato;
font-weight: 900;
text-align: center;
padding: 10px 0;
border-radius: 50px;
font-size: 25px;
transition: background-color 0.25s linear, box-shadow 0.25s linear;
float: left;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
box-shadow: 0 0 5px black;
margin: 0;
}
.top-block:hover {
cursor: pointer;
box-shadow: 0 0 15px black;
}
.top-block-dropdown {
width: 100%;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
margin-top: 7.5px;
border-radius: 25px;
box-shadow: 0 0 15px black;
opacity: 0;
height: 0;
transform: translateY(-2em);
transition: transform 0.25s, opacity 0.25s linear;
}
.dropdown-option-heading {
font-family: Lato;
font-weight: 700;
margin: 5px 0 0 0;
padding: 5px 10px;
border-bottom: 2px solid white;
}
.dropdown-option {
font-family: Lato;
font-weight: 400;
text-align: center;
border-bottom: 1px solid white;
margin: 0;
padding: 5px 10px;
transition: box-shadow 0.25s linear;
}
.dropdown-option:hover {
background: linear-gradient(to top, dodgerblue, #00B0FF);
cursor: pointer;
}
.last-option {
border: 0;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
<div class="top-block-container">
<h1 class="top-block">ECWMF</h1>
<div class="top-block-dropdown">
<p class="dropdown-option-heading">Global Models</p>
<p class="dropdown-option">GFS</p>
<p class="dropdown-option">ECMWF</p>
<p class="dropdown-option">CMC</p>
<p class="dropdown-option">NAVGEM</p>
<p class="dropdown-option">UKMET</p>
<p class="dropdown-option-heading">Mesoscale Models</p>
<p class="dropdown-option">HRRR</p>
<p class="dropdown-option">HWRF</p>
<p class="dropdown-option">NAM 32km</p>
<p class="dropdown-option">NAM 12km</p>
<p class="dropdown-option">RAP</p>
<p class="dropdown-option">SREF</p>
<p class="dropdown-option last-option">HIRESW</p>
</div>
</div>

Not able to center align text

I have buttons as active and deactive. These buttons are used as toggle. I want center align text in button. Please help.
Here is code snippet in Plunker
CSS Code
body {
font-family: 'Montserrat', sans-serif;
background-color: #E5E5E5;
min-width: 1280px;
overflow: scroll;
}
/* toggle switch style ======================================= */
.profile_status {
padding: 6px 50px 0px 0px;
}
.active_inactive_container {
display: inline-block;
height: 28px;
border: 1px solid #DFDFDF;
background-color: #FFFFFF;
border-radius: 15px;
padding: 2px 0px 2px 2px;
}
.active_button,
.inactive_button,
.clicked_active_button,
.clicked_inactive_button {
height: 22px;
background-color: #FFFFFF;
border: none !important;
color: #333333;
border-radius: 15px;
outline: none;
font-size: 11px;
padding: 0px 5px 0px 18px;
}
.clicked_active_button {
background-color: #51B151 !important;
color: #FFFFFF !important;
margin-left: 62px;
position: absolute;
opacity: 0;
}
.clicked_active_button1 {
opacity: 1 !important;
-webkit-transform: translateX(-140px);
-ms-transform: translateX(-140px);
transform: translateX(-140px);
transition: .1s;
}
.clicked_inactive_button {
background-color: #f75252 !important;
color: #FFFFFF !important;
margin-left: 6px;
position: absolute;
opacity: 0;
}
.clicked_active_switch {
margin-left: 78px !important;
}
Html Code
<div class="active_inactive_container toggle_switch_container">
<button class="clicked_inactive_button clicked_inactive_switch ng-binding">Inactive</button>
<button class="active_button ng-binding" ng-click="">Active</button>
<button class="clicked_active_button clicked_active_switch ng-binding clicked_active_button1" >Active</button>
<button class="inactive_button ng-binding" >Inactive</button>
</div>
How to centralize the Active and Inactive button text?
change padding
.active_button, .inactive_button, .clicked_active_button, .clicked_inactive_button {
background-color: #ffffff;
border: medium none !important;
border-radius: 15px;
color: #333333;
font-size: 11px;
height: 22px;
outline: medium none;
padding: 0 11px;
}
remove the height and play with the padding of the container it will work .
.active_inactive_container {
display: inline-block;
border: 1px solid #DFDFDF;
background-color: #FFFFFF;
border-radius: 15px;
padding: 6px 10px;
}
Padding for the buttons is the problem padding: 0px 5px 0px 18px;
try changing it like this
padding: 0px 10px 0px 10px;
margin: 0px 0px 0px 23px;
This may not be the best solution out there
Update
Here is a working fiddle: http://codepen.io/anon/pen/WoBVZM?editors=0100
Below is the class I changed, just modified padding and added margin.
I used padding to fix the text alignment issue and margin to center the button.
.active_button, .inactive_button, .clicked_active_button, .clicked_inactive_button
{
height: 22px;
background-color:#FFFFFF;
border:none !important;
color: #333333;
border-radius: 15px;
outline: none;
font-size: 11px;
padding: 0px 10px 0px 10px;
margin: 2px 5px;
}
I found that by adding the padding: 0 11px; to .active_button, .inactive_button, .clicked_active_button, .clicked_inactive_button your problem will be resolved. Also i added some margin to .active_inactive_container button.
Please check the entire CSS Changes below.
.active_inactive_container button{
margin:3px;
}
.active_button, .inactive_button, .clicked_active_button, .clicked_inactive_button
{
height: 22px;
background-color:#FFFFFF;
border:none !important;
color: #333333;
border-radius: 15px;
outline: none;
font-size: 11px;
padding: 0 11px;
}
You mean like this?
body {
font-family: 'Montserrat', sans-serif;
background-color: #E5E5E5;
min-width: 1280px;
overflow: scroll;
}
.profile_status {
padding: 6px 50px 0px 0px;
}
.active_inactive_container {
display: table;
border: 1px solid #DFDFDF;
background-color: #FFFFFF;
border-radius: 15px;
}
.active_button,
.inactive_button,
.clicked_active_button,
.clicked_inactive_button {
display: table-cell;
vertical-align: middle;
padding: 1rem;
background-color: #FFFFFF;
border: none !important;
color: #333333;
border-radius: 15px;
text-align: center;
outline: none;
font-size: 11px;
margin: 0;
}
You need to add the padding to get the text in center. i have created demo for both active and inactive option selected.
edited padding in this class
.active_button,
.inactive_button,
.clicked_active_button,
.clicked_inactive_button {
height: 22px;
background-color: #FFFFFF;
border: none !important;
color: #333333;
border-radius: 15px;
outline: none;
font-size: 11px;
padding: 0px 18px 0px 18px;
}
Example :
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
});
body {
font-family: 'Montserrat', sans-serif;
background-color: #E5E5E5;
min-width: 1280px;
overflow: scroll;
}
/* toggle switch style ======================================= */
.profile_status {
padding: 6px 50px 0px 0px;
}
.active_inactive_container {
display: inline-block;
height: 28px;
border: 1px solid #DFDFDF;
background-color: #FFFFFF;
border-radius: 15px;
padding: 2px 0px 2px 2px;
}
.active_button,
.inactive_button,
.clicked_active_button,
.clicked_inactive_button {
height: 22px;
background-color: #FFFFFF;
border: none !important;
color: #333333;
border-radius: 15px;
outline: none;
font-size: 11px;
padding: 0px 18px 0px 18px;
}
.clicked_active_button {
background-color: #51B151 !important;
color: #FFFFFF !important;
margin-left: 62px;
position: absolute;
opacity: 0;
}
.clicked_active_button1 {
opacity: 1 !important;
-webkit-transform: translateX(-140px);
-ms-transform: translateX(-140px);
transform: translateX(-140px);
transition: .1s;
}
.clicked_inactive_button1 {
opacity: 1 !important;
-webkit-transform: translateX(-140px);
-ms-transform: translateX(-140px);
transform: translateX(-140px);
transition: .1s;
}
.clicked_inactive_button {
background-color: #f75252 !important;
color: #FFFFFF !important;
margin-left: 6px;
position: absolute;
opacity: 0;
}
.clicked_active_switch {
margin-left: 78px !important;
}
.clicked_inactive_switch {
margin-left: 198px !important;
}
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<script data-require="angular.js#1.4.x" src="https://code.angularjs.org/1.4.12/angular.js" data-semver="1.4.9"></script>
<link data-require="bootstrap#4.0.5" data-semver="4.0.5" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<script data-require="bootstrap#4.0.5" data-semver="4.0.5" src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl as $ctrl">
<div class="active_inactive_container toggle_switch_container">
<button class="clicked_inactive_button clicked_inactive_switch ng-binding">Inactive</button>
<button class="active_button ng-binding" ng-click="$ctrl.toggleSwitchOn()">Active</button>
<button class="clicked_active_button clicked_active_button1 clicked_active_switch ng-binding " >Active</button>
<button class="inactive_button ng-binding" ng-click="$ctrl.toggleSwitchOff()">Inactive</button>
</div>
<div class="active_inactive_container toggle_switch_container">
<button class="clicked_inactive_button clicked_inactive_switch clicked_inactive_button1 ng-binding">Inactive</button>
<button class="active_button ng-binding" ng-click="$ctrl.toggleSwitchOn()">Active</button>
<button class="clicked_active_button clicked_active_switch ng-binding " >Active</button>
<button class="inactive_button ng-binding" ng-click="$ctrl.toggleSwitchOff()">Inactive</button>
</div>
</body>
</html>

Text difference from Firefox to Chrome

<div id="slide1">
<span id="tf1">BUILDING YOUR HOME <br>TO BE COMFY AND WARM</span>
</div>
#tf1 {
opacity: 0.9;
line-height: 50px;
text-align: center;
display: block;
color: /*#505050*/ #505050;
text-shadow: /*#a8a8a8*/#9f9f9f -2px 1px 1px;
font-size: 41px;
font-family: Globerb;
}
#tf1::first-line {
color: /*#323232*/ #323232;
text-shadow: /*#969696*/#8c8c8c -2px 1px 1px;
font-size: 60px;
font-family: Globerb;
display: block;
}
#slide1 {
/*transform: skew(0deg, 5deg);*/
opacity: 0;
position: absolute;
padding-top: 40px;
margin-left: 19.7916%;
margin-top: 0px;
}
The problem is that in firefox, the text looks good 2 lines and thats all, but in chrome it goes into three lines. I have no idea why this is, but I guess that there is a some sort of fix via css?
<html>
<head>
<style>
#tf1 {
opacity: 0.9;
line-height: 50px;
text-align: center;
display: block;
color: /*#505050*/ #505050;
text-shadow: /*#a8a8a8*/#9f9f9f -2px 1px 1px;
font-size: 41px;
font-family: Globerb;
}
#tf1::first-line {
color: /*#323232*/ #323232;
text-shadow: /*#969696*/#8c8c8c -2px 1px 1px;
font-size: 60px;
font-family: Globerb;
display: block;
}
#slide1 {
/*transform: skew(0deg, 5deg);*/
opacity: 0;
position: absolute;
padding-top: 40px;
margin-left: 19.7916%;
margin-top: 0px;
}
</style>
</head>
<body>
<p id="tf1">BUILDING YOUR HOME <br>TO BE COMFY AND WARM</p>
</body>
</html>
chrome
firefox
ie