:before element not displaying properly in firefox - html

Why does firefox misplace the :before element??
<div id='remember_forgot' class='no_hl'>
<div>
<input id='remember_me' type='checkbox'>
<label for='remember_me'>Remember me</label>
</div>
</div>
* {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.3;
font-weight: normal;
}
input[type='checkbox'] {
display: none;
}
#remember_forgot {
display: flex;
align-items: center;
justify-content: space-between;
margin: 2px 0;
}
#remember_forgot>div {
position: relative;
display: flex;
align-items: center;
}
#remember_me+label:before {
position: relative;
top: 1px;
content: "";
display: block;
float: left;
width: 13px;
height: 13px;
margin-right: 4px;
font-size: 15px;
line-height: 0.8;
border: 1px solid black;
}
#remember_me:checked+label:before {
content:'āœ“';
color: black;
}
#remember_me+label {
display: inline-block;
margin-left: 0px;
color: black;
font-size: 13px;
}
#remember_me+label:hover {
color: #e1b941;
}
#remember_me,
#remember_me+label,
#forgot {
cursor: pointer;
}
#remember_me+label {
transition: 0.2s all;
}
All of the relevant code is here in the fiddle: http://jsfiddle.net/kjf8h5m6/7/
When I open it in chrome the checkbox :before element is properly centered:
But when it is viewed in firefox the checkbox looks like it is not centered:
This is very annoying.. please help!

(Left is chrome, right is firefox)
Removing the wildcard line-height: *{line-height:1.3;}, and adding a line-height of 1.5 to the label element solves this in both Firefox and Chrome.
Working fix: http://jsfiddle.net/kjf8h5m6/9/

Related

google icon on button make white space

I have some buttons but the button with google icon inside produce a white space, if I change the icon (span) using text the circle one will be aligned to another correctly, i think its the span of the google icon but have no idea how to fix it, hope someone can help, thanks in advance
this is html
<div className="col-left">
<Button icon="add" className="mr-8" theme="primary|md" handleClick={()=> alert(1)} label="Create" />
<Button className="mr-5" theme="primary-transparent|md" handleClick={()=> alert(1)} label="Approve" />
<Button className="mr-5" theme="primary-transparent|md" handleClick={()=> alert(1)} label="Decline" />
<Button className="mr-5" theme="primary-transparent|md" handleClick={()=> alert(1)} label="Approve" />
{/* <span className="separator"></span> */}
<Button icon="add" className="mr-5" theme="primary-transparent|circle|md" />
</div>
this is the scss
.btn {
display: inline-grid;
border: 0;
background: red !important;
cursor: pointer;
&.btn-md {
font-size: 22px;
height: 40px;
}
&.btn-sm {
font-size: 18px;
span {
font-size: inherit;
}
}
&.btn-a {
color: #777;
background: transparent;
&:hover {
background: #e7e6e5;
}
}
&.btn-circle {
display: inline-grid;
background: $clr-primary;
place-items: center;
&.btn-sm {
#include circle(40px);
}
&.btn-md {
#include circle(40px);
}
span {
grid-column: 1/2;
margin: 0;
}
}
&.btn-primary {
background: $clr-primary;
color: white;
border-radius: 2px;
padding: 0px 16px;
font-size: 13px;
align-items: center;
}
span {
display: inline-block;
grid-column: 2/3;
margin-left: 10px;
font-size: 16px;
}
&.btn-primary-transparent {
border-radius: 2px;
padding: 8px 8px;
font-weight: 700;
color: $clr-primary;
font-size: 13px;
background: #fafafa;
align-items: center;
}
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
display: inline-block;
line-height: 4px;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
font-feature-settings: 'liga';
You can add css to the parent div. This should work without any other modifications as you have margins set to your buttons. The display: flex; (on the parent) will remove the need of using inline-block on the buttons.
.col-left {
display: flex;
align-items: center;
}

how to add right border before icon in button

I want to add a border in the button before the icon
what I m using is that
my code is this
.button {
background-color: #4CAF50;
border: none;
color: white;
Width: 660px;
Height:55px;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
background: #333333;
position: absolute;
left: 16.76%;
right: 16.68%;
top: 27.29%;
bottom: 30.89%;
font-family: DIN Pro;
font-style: normal;
font-weight: bold;
font-size: 18px;
line-height: 23px;
text-align: center;
text-transform: uppercase;
color: #F6F6F6;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
Contact<span style="border:solid 1px white"><i class="fa fa-home;"></span></i>
</body>
</html>
but it is not setting up like that. I want to set it up like the same is in the picture
Here is the code you need for the button. To answer your question about the border on the icon, I added a pseudo element (:after) to the button which contains the arrow icon. Then it was just a matter of applying border-left to it.
/* button styles */
.button {
background-color: slategray;
font-family: sans-serif;
border: none;
outline: none;
min-height: 42px;
min-width: 180px;
max-width: 100%;
font-weight: bold;
text-decoration: none;
cursor: pointer;
font-size: 18px;
text-align: center;
text-transform: uppercase;
color: #F6F6F6;
display: inline-flex;
justify-content: center;
align-items: center;
padding: 8px 52px 8px 10px;
position: relative;
}
.button:after {
content: "\f061";
display: flex;
position: absolute;
font-family: "Font Awesome 5 Free", sans-serif;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
width: 42px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
border-left: 1px solid #8192a2;
}
.button:hover {
background-color: #8192a2;
}
.button:hover:after {
border-left-color: #95a7b8;
}
/* example styles */
body,
html {
padding: 0;
margin: 0;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background: coral;
}
* {
box-sizing: border-box;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css">
Contact

Why is the distance greater with a margin top in IE?

I have the following component in my application
.call-support {
display: flex;
justify-content: center;
padding: 20px 0 20px 0;
}
.container-support {
display: flex;
align-items: center;
}
.support-text {
text-align: center;
margin-left: 10px;
}
.title-text {
font-family: "RalewayRegular";
font-weight: bold;
font-size: 16px;
}
.subtitle-text {
font-family: "RalewayRegular";
font-weight: normal;
font-size: 16px;
}
.customer-service-request {
display: flex;
flex-direction: column;
align-items: center;
padding: 10% 0 20% 0;
}
.request-text {
display: flex;
}
.number {
font-size: 18px;
color: #D53865;
font-weight: bold;
background-color: #f9f4f1;
width: 340px;
height: 130px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.number:before {
content: "";
position: absolute;
top: 0;
right: 0;
border-top: 65px solid #666B74;
border-left: 65px solid #f9f4f1;
width: 0;
border-bottom: 65px solid #666B74;
}
.subtitle-number {
position: absolute;
font-family: "RalewayRegular";
font-weight: normal;
font-size: 12px;
display: flex;
margin-top: 40px;
}
.number-request {
font-family: "RalewayRegular";
color: #fff;
font-size: 18px;
font-weight: bold;
background-color: #666B74;
height: 40px;
width: 340px;
height: 130px;
display: flex;
justify-content: center;
align-items: center;
}
<div class="call-support">
<div class="container-support">
<div class="request-text">
<p class="number">000 000 000<span class="subtitle-number">(local call)</span></p>
<p class="number-request">Customer Service</p>
</div>
</div>
</div>
It is well laid out with this css in all browsers, except in Internet Explorer where the margin top of "subtitle-number" shows it almost stuck to the margin-bottom of the box it belongs to.
Here I leave a link to a codepen with the design.
https://codepen.io/CharlieJS/pen/dyXyBBe
and an image of how it looks in Internet Explorer
How can I adjust the design to display in all browsers?
Why is the margin-bottom higher in IE?
thank you all for your time and help
This is created by display: flex; in class .subtitle-number. So just remove it and it will work fine.
Try to set this class wit top & left like:
.subtitle-number {
position: absolute;
font-family: "RalewayRegular";
font-weight: normal;
font-size: 12px;
/*display: flex;
margin-top: 40px;*/
top:70%;
left:50%;
transform: translate(-50%, 30%);
}
As position absolute is better set with top, right, bottom, left. It seems to work fine by me on w3schools on IE11.
DEMO
.call-support {
display: flex;
justify-content: center;
padding: 20px 0 20px 0;
}
.container-support {
display: flex;
align-items: center;
}
.support-text {
text-align: center;
margin-left: 10px;
}
.title-text {
font-family: "RalewayRegular";
font-weight: bold;
font-size: 16px;
}
.subtitle-text {
font-family: "RalewayRegular";
font-weight: normal;
font-size: 16px;
}
.customer-service-request {
display: flex;
flex-direction: column;
align-items: center;
padding: 10% 0 20% 0;
}
.request-text {
display: flex;
}
.number {
font-size: 18px;
color: #D53865;
font-weight: bold;
background-color: #f9f4f1;
width: 340px;
height: 130px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.number:before {
content: "";
position: absolute;
top: 0;
right: 0;
border-top: 65px solid #666B74;
border-left: 65px solid #f9f4f1;
width: 0;
border-bottom: 65px solid #666B74;
}
.subtitle-number {
position: absolute;
font-family: "RalewayRegular";
font-weight: normal;
font-size: 12px;
/*display: flex;
margin-top: 40px;*/
top:70%;
left:50%;
transform: translate(-50%, 30%);
}
.number-request {
font-family: "RalewayRegular";
color: #fff;
font-size: 18px;
font-weight: bold;
background-color: #666B74;
height: 40px;
width: 340px;
height: 130px;
display: flex;
justify-content: center;
align-items: center;
}
<div class="call-support">
<div class="container-support">
<div class="request-text">
<p class="number">000 000 000<span class="subtitle-number">(local call)</span></p>
<p class="number-request">Customer Service</p>
</div>
</div>
</div>
The absolute property is set in this style but the coordinate value is not set. Because of the different calculation methods such as element position parameters in different browsers, the results are not the same in different browsers.
At this time, it is not necessary to use relative positioning, but to have a certain coordinate. Please modify the .subtitle-number style as following:
.subtitle-number {
position: absolute;
font-family: "RalewayRegular";
font-weight: normal;
font-size: 12px;
top: 80px;
left: 145px;
}
Result in IE:

Getting :after to add underline only under text and not the entire container

I am wanting titles underlined with the :after method. I am getting it to work partially. What I cannot figure out is how to get the underline ("after) to only be under the span text inside of the .slantTitleWrap.
Does anyone see what I am doing wrong?
.slantBlock2Title {
color: #4D4D4D;
font-size: 1.5rem;
font-family: 'Muli', sans-serif;
line-height: 1.5em;
}
.slantTitleWrap span:after {
content: '';
display: block;
width: 40%;
margin-top: 5px;
background: #b82222;
height: 2px;
}
<div class="slantTitleWrap">
<span class="slantBlock2Title">Uderline me</span>
</div>
You can achieve this by using 'display: inline-block'.
.slantBlock2Title {
color: #4D4D4D;
font-size: 1.5rem;
font-family: 'Muli', sans-serif;
line-height: 1.5em;
display: inline-block;
}
.slantTitleWrap span:after {
content: '';
display: block;
width: 100%;
margin-top: 5px;
background: #b82222;
height: 2px;
}
<div class="slantTitleWrap">
<span class="slantBlock2Title">Uderline me</span>
</div>
I only added the positions to make it work like you wanted:
.slantBlock2Title {
position: relative; /* Added */
color: #4D4D4D;
font-size: 1.5rem;
font-family: 'Muli', sans-serif;
line-height: 1.5em;
}
.slantTitleWrap span:after {
position: absolute; /* Added */
content: '';
display: block;
width: 100%; /* Modified */
margin-top: 5px;
background: #b82222;
height: 2px;
}
p{
font-family: 'Muli', sans-serif;
}
<div class="slantTitleWrap">
<span class="slantBlock2Title">U<u>n</u>derline me</span>
</div>
<br>
<p>(I added the ā€œnā€, too! :D)</p>
Hope it helps!

How to style this <hr> with image and text in the middle?

So I am styling this horizonal line with the idea of image and text in the middle and got stuck. How could I align the image on the left side of "TEXT" and not under it? Here's the link to demonstrate the current state:
http://codepen.io/anon/pen/MJWJad
Appreciate all the help.
.horizontal__rule--modified {
line-height: 1em;
position: relative;
border: 0;
color: #666666;
text-align: center;
height: 1.5em;
opacity: 0.7;
letter-spacing: 1px;
font-size: 16px;
&:before {
content: url(http://www.metalguitarist.org/forum/images/mgtwitter.png);
background: red;
position: absolute;
left: 0;
top: 50%;
width: 100%;
height: 2px;
}
&:after {
content: attr(data-content);
position: relative;
display: inline-block;
color: black;
padding: 0 .5em;
line-height: 1.5em;
color: red;
background-color: #fcfcfa;
}
}
<hr class="horizontal__rule--modified" data-content="TEXT">
Actually you don't need a <hr /> at all here. You can just use pseudo elements and make it possible:
* {
font-family: 'Segoe UI';
font-weight: normal;
}
h1 {
text-align: center;
}
h1 span {
background-color: #fff;
padding: 15px;
}
h1::after {
display: block;
content: "";
border: 1px solid #ccc;
margin-top: -0.5em;
}
<h1><span>Hello</span></h1>
If an image is needed for this like having a twitter icon, you can use: Source:
* {
font-family: 'Segoe UI';
font-weight: normal;
vertical-align: middle;
}
h1 {
text-align: center;
font-size: 14pt;
}
h1 span {
background-color: #fff;
padding: 15px;
}
h1::after {
display: block;
content: "";
border: 1px solid #ccc;
margin-top: -0.5em;
}
<h1>
<span>
<img src="http://www.metalguitarist.org/forum/images/mgtwitter.png" alt="" />
Hello
</span>
</h1>
Preview
Another solution apart from Praveen's is to use flex-box.
HTML
<div class="wrapper">
<div class="line"></div>
<div class="text">
Test
</div>
<div class="line"></div>
</div>
CSS
.wrapper {
display: flex;
justify-content: space-between;
align-items: center;
}
.line {
height: 10px;
background: black;
width: 100%;
}
.text {
padding: 0 10px;
}
fiddle: https://jsfiddle.net/jdgqmmv5/