backface-visibility not working in Firefox (works in Chrome) - html

backface-visibility not working in Firefox (works in Chrome)
I'm trying to make a form for a credit card that flips over to show the cvc number.
But in Firefox the backside doesn't show at all and the front side shows on both sides, but it works properly in Chrome.
I've tried adding prefixes but it still doesn't work.
Thanks for any help you can give😊
CodePen
HTML:
<div id="on-card-content">
<div id="on-card">
<div id="on-card-inner">
<div id="on-card-front">
<div id="icon-box">
</div>
<div id="number-box">
<label for="on-card-number">Card Number</label>
<input type="text" name="on-card-number" id="on-card-number" placeholder="•••• •••• •••• ••••">
</div>
<div id="name-box">
<label for="on-card-name">Cardholder Name</label>
<input type="text" name="on-card-name" id="on-card-name" placeholder="Your Name">
</div>
<div id="exp-box">
<label for="on-card-exp">Expiry Date</label>
<input type="text" name="on-card-exp" id="on-card-exp" placeholder="MM/YY">
</div>
</div>
<div id="on-card-back">
<div id="swipe-bar"></div>
<input type="text" name="on-card-cvc" id="on-card-cvc" placeholder="123">
<label for="on-card-cvc">CVC</label>
<p id="card-agree">Use of this card is subject to the credit card agreement.</p>
</div>
</div>
</div>
<button type="button" id="card-button"></button>
</div>
CSS:
#on-card-content {
width: fit-content;
width: -moz-fit-content;
}
#on-card {
font-family: 'Source Sans Pro', sans-serif;
width: 320px;
height: 190px;
background: linear-gradient(410deg, #808080 60%, #000000 60%);
margin: 0 auto;
border-radius: 15px;
color: white;
box-shadow: 0 0 15px #0707074d;
transition: transform 0.8s;
transform-style: preserve-3d;
}
#on-card.is-active {
transform: rotateY(-180deg);
box-shadow: 0 0 15px #0707074d;
}
#card-button{
border-radius: 15px;
text-align: center;
margin: 5% 40%;
background: #1a1f71;
color: #ffffff;
border: none;
padding: 10px 10px;
}
#card-button.is-active {
background: #e60404;
}
#card-button::after {
content: 'Next';
}
#card-button.is-active::after {
content: 'Back';
}
#on-card-back {
transform: rotateY(-180deg);
}
#swipe-bar {
background: #000000;
height: 20%;
width: inherit;
margin-top: 5%;
}
#swipe-bar {
background: #000000;
height: 20%;
width: inherit;
margin-top: 5%;
}
#on-card-inner {
background-color: #b3a4a4b3;
border-radius: 15px;
height: inherit;
transition: all 1s ease;
}
#on-card-number {
background: transparent;
border: none;
color: white;
}
#on-card-name {
background: transparent;
border: none;
color: white;
}
#on-card-exp {
background: transparent;
border: none;
color: white;
}
#on-card-front{
transform:rotateY(0deg);
}
#on-card-front,
#on-card-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
#on-card-name {
text-transform: uppercase;
}
#on-card-number {
font-size: 145%;
width: 100%;
}
#icon-box {
height: 5rem;
}
#number-box {
margin-left: 5%;
margin-bottom: 3%;
}
#name-box {
width: 50%;
float: left;
margin-left: 5%;
}
#on-card-name {
width: 100%;
}
#exp-box {
width: 40%;
float: right;
margin-right: 3%;
}
#on-card-exp {
width: 100%;
}
#on-card-cvc {
text-align: right;
margin-top: 5%;
height: 15%;
}
#card-agree {
font-size: 70%;
margin: 5%;
}
JS:
const cardButton = document.getElementById('card-button')
const card = document.getElementById("on-card");
cardButton.addEventListener('click', () => {
card.classList.toggle('is-active')
cardButton.classList.toggle('is-active')
})
The Solution from the "duplicate" Question doesn't solve the issue

I need to remove <div id="on-card-inner"> and rework the colour transition I have on that to the front and back.
Firefox seems to not work when child elements that have child elements that have backface-visibility set to hidden.

Related

how to make notification page i am struggling with user box

I want it to look like this
but it look's like this
I used max-height it didn't work
I used position it didn't work
I messed with size it didn't work
body {
text-align: center;
background: hsl(210, 60%, 98%);
font-family: sans-serif;
margin: 0;
}
#Notifications-page {
display: table;
max-width: 90%;
min-width: 150px;
border-radius: 15px;
text-align: center;
margin: 5% 25% 5% 25%;
padding-bottom: 10px;
background-color: hsl(0, 0%, 100%);
}
.relative-left {
position: relative;
float: left;
}
.messages {
display: table;
width: 90%;
margin: auto;
border-radius: 15px;
background-color: white;
}
.unread-color {
background-color: hsl(211, 68%, 94%);
}
.user-img {
width: 7%;
margin: 15px;
}
.messages-h1 {
font-size: 1.3rem;
margin-right: 8px;
margin-bottom: 0;
font-weight: bold;
}
.P-margin {
margin: 21px 4px 0 4px;
}
.P-1 {
color: gray;
}
.P-2 {
color: hsl(219, 12%, 42%);
font-weight: bold;
margin-right: auto;
}
.P-3 {
display: block;
margin-right: 80%;
position: relative;
float: right;
font-size: 0.8rem;
}
<section id="Notifications-page">
<div class="messages unread-color relative-left">
<img class=" user-img relative-left" src="assets\images\avatar-nathan-peters on.webp" alt="">
<p class=" relative-left messages-h1">Nathan Peterson </p>
<p class=" relative-left P-margin P-1"> reacted to your recent post</p>
<p class=" relative-left P-margin P-2">5 end-game strategies to increase your win rate</p>
<p class="P-3">2 weeks ago</p>
</div>
</section>
You would want none of those elements to be block, as from seen in the desired result the elements are all inline (except for the bottom timestamp). This should suffice:
*
{
font-family: 'Arial', sans-serif;
margin: 0;
}
html, body
{
height: 100%;
}
body
{
background: whitesmoke;
display: flex;
}
section#Notifications-page
{
background: white;
margin: 0 auto;
color: gray;
width: 600px;
}
section#Notifications-page > div
{
padding: 40px;
display: flex;
gap: 15px;
}
section#Notifications-page > div img
{
height: 40px;
width: 40px;
object-fit: cover;
border-radius: 50%;
}
section#Notifications-page > div div
{
flex: 1;
}
b.user
{
color: black;
}
<section id="Notifications-page">
<div>
<img src="https://cdn1.vectorstock.com/i/thumb-large/77/30/default-avatar-profile-icon-grey-photo-placeholder-vector-17317730.jpg" alt="">
<div>
<p><b class = 'user'>Nathan Peterson</b> reacted to your recent post <b>5 end-game strategies to increase your win rate</b></p>
<small>2 weeks ago</small>
</div>
</div>
</section>

Altering background color of button to flow into header on select

I'm trying to altar two buttons (Easy, Hard) on a web app I'm building. I am trying to alter them to remove their borders, and when a button is selected, I want to background to flow up into the header as a visual indication for being selected.
Note: I am linking Bootstrap 4 at the moment.
Current Visual:
Desired Visual:
body {
background-color: #232323;
}
.header {
text-align: center;
color: white;
padding: 1.5rem;
background-color: #66b0c4;
}
.header h1 {
margin: 0;
}
.square {
width: 30%;
background: purple;
padding-bottom: 30%;
float: left;
margin: 1.66%;
}
#container {
max-width: 600px;
margin: 0 auto;
}
#stripe {
background-color: white ;
height: 30px;
text-align: center;
color: black;
}
.selected {
background:#66b0c4;
border: none;
}
<div class="header">
<h1>The Great <br><span id="colorDisplay">RGB</span><be>
Color Game</h1>
</div>
<div id="stripe">
<button id="reset">New Colors</button>
<span id="message"></span>
<button id="easyBtn">Easy</button>
<button id="hardBtn" class="selected">Hard</button>
</div>
I hope this can help you.
body {
background-color: #232323;
}
.header {
text-align: center;
color: white;
padding: 1.5rem;
background-color: #66b0c4;
}
.header h1 {
margin: 0;
}
.square {
width: 30%;
background: purple;
padding-bottom: 30%;
float: left;
margin: 1.66%;
}
#container {
max-width: 600px;
margin: 0 auto;
}
#stripe {
background-color: white ;
height: 30px;
text-align: center;
color: black;
padding-top: 5px;
}
.selected {
background:#66b0c4;
border: 0;
padding: 5px;
position: relative;
}
.selected::before {
position: absolute;
content: '';
top: -10px;
left: 0;
width: 100%;
background-color: #66b0c4;
height: 10px;
}
<div class="header">
<h1>The Great <br><span id="colorDisplay">RGB</span><be>
Color Game</h1>
</div>
<div id="stripe">
<button id="reset">New Colors</button>
<span id="message"></span>
<button id="easyBtn">Easy</button>
<button id="hardBtn" class="selected">Hard</button>
</div>
Solved by adjusting the height of background on the selected class. Also solved the selection issue with
*:focus {
outline: 0 !important;
}
CSS Now:
.selected {
background:#66b0c4;
border: none;
height: 30px;
}
*:focus {
outline: 0 !important;
}

How to make image swallowed out of window size without create blank space

this is something I built:
https://i.imagesup.co/images2/e51854cad0f72ef2900debd5518472d71713cc71.png
There is no overflow because I put in body tag overflow-x:hidden, and it's kind of "nasty" way.
I tried to set div container as width:100vw,max-width:100vw; but it's still not helping. tried to do it with a negative margin and every possible way I know but it's still create overflow like this:
https://i.imagesup.co/images2/794cf0f60d80b8a2de4f5ac44d93579bd50ace2d.png
This the relevant code of the light blue part, thanks in advance:
<body>
<div id="divStyle1">
<header>
<h1>
<span>How to <span class="importantH1">ripen Avocado</span> quickly ?</span>
<span><span class="importantH1">RFP bags</span> ripen Avocado within <span class="importantH1">12-24 hours !</span></span>
</h1>
</header>
<main>
<div id="purpuleLineBox">
<div id="purpuleLine1"> <p>100% recyclable and bio-degradable</p> </div>
<div id="purpuleLine2"> <p>Simulates the natural ripening process, organic</p> </div>
<div id="purpuleLine3"> <p>The quickest way to achieve the perfect avocado taste</p> </div>
<div id="purpuleLine4"> <p>Work with Mango, Banana, Peach, and another climacteric fruits</p> </div>
<div id="purpuleLine5"> <p>The user interface on the bag shows when an avocado is fully ripen</p> </div>
</div>
<img id="logoImg" src="Logo.png" alt="">
</main>
</div>
</body>
body {
margin: 0 auto;
}
html {
scroll-behavior: smooth;
}
#divStyle1 {
height: 90vh;
background-color: #016087;
}
h1>span {
display: block;
}
h1 {
color: white;
text-shadow: 2px 2px black;
font-size: 45px;
margin: 0 auto;
}
.importantH1 {
border-bottom: 10px solid #D52C82;
font-size: 53px;
}
.importantH1:hover {
border-bottom: 15px solid #D52C82;
font-size: 55px;
transition-duration: 0.5s;
}
#logoImg {
position: absolute;
right: -20px;
top: 10vh;
transform: rotate(8deg);
border: 20px dashed white;
padding-left: 20px;
padding-bottom: 20px;
padding-bottom: 20px;
}
#purpuleLineBox {
margin-top: 100px;
}
#purpuleLine1 {
background-color: #D52C82;
height: 50px;
width: 34%;
margin-bottom: 30px;
}
#purpuleLine2 {
background-color: #D52C82;
height: 50px;
width: 44%;
margin-bottom: 30px;
}
#purpuleLine3 {
background-color: #D52C82;
height: 50px;
width: 52%;
margin-bottom: 30px;
}
#purpuleLine4 {
background-color: #D52C82;
height: 50px;
width: 58%;
margin-bottom: 30px;
}
#purpuleLine5 {
background-color: #D52C82;
height: 50px;
width: 60%;
margin-bottom: 30px;
}
div>p {
font-size: 30px;
color: white;
text-shadow: 2px 2px black;
font-weight: bold;
margin-top: 0px;
}
This is happening due to a combination of using absolutely positioned right: -20px; and transform: rotate(8deg); if you remove the transform and set right to 0 it should not have the blank space.
If you want to keep these styles just use overflow-x: hidden;

Weird spaces between html elements

I have a simple website with 3 controls, yet somehow they are shown in a really weird way.
I've added the red background to show the gap. So far I've tried setting margin/padding to 0, also tried box-sizing but it changed only the width of these elements, didnt make the gaps go away.
#font-face {
font-family: KongText;
src: url('kongtext.ttf');
}
body {
background-color: Highlight;
font-family: KongText
}
h1 {
font-size: 4em;
text-align: center;
}
/*default.cshtml*/
#creator {
width: 350px;
margin: auto;
margin-top: 10%;
display: flex;
}
#joinRoom {
background-color: coral;
height: 50px;
width: 346px;
font-size: 30px;
display: none;
}
#creatorButtons {
width: 350px;
margin: auto;
}
#join {
background-color: coral;
width: 350px;
height: 50px;
font-family: KongText;
font-size: 1.4em;
}
#create {
background-color: coral;
width: 350px;
height: 50px;
font-family: KongText;
font-size: 1.3em;
margin-top: 1px;
}
#footer {
font-size: 13px;
position: fixed;
bottom: 0;
right: 0;
}
/*room.cshtml*/
#chat {
width: 300px;
margin: 0 auto;
}
#chatBox {
resize: none;
width: inherit;
}
#message {
width: inherit;
}
#msgSend {
width: inherit;
}
<body>
<div id="container">
<div id="header">
<h1>Chat Together 826</h1>
</div>
<div id="main">
<div id="chat">
<textarea id="chatBox" rows="40" cols="50" readonly="readonly"></textarea>
<input type="text" id="message" placeholder="Your message" />
<input type="button" id="msgSend" value="Send" />
</div>
</div>
<div id="footer">
© 2016 Chat Together
</div>
</div>
</body>
</html>
Padding has nothing to do with it. You need to change how the browser displays the textarea.
Try updating your CSS for your chatBox element to this:
#chatBox {
display: block; /* Add this line */
resize: none;
width: inherit;
}

How to Position an Image underneath a form in CSS

I am making a login page and I would to position a custom image border to the center underneath the form.
The image is not positioning to the margin-left properly.
Can anyone suggest a solution?
Below is the code:
#import url(http://fonts.googleapis.com/css?family=Droid+Sans);
#import url(http://fonts.googleapis.com/css?family=Roboto);
* {
text-align: center;
}
img {
z-index: -1;
width: 350px;
height: 200px;
margin-top: 200px;
background-size: cover;
position: absolute;
}
body {
background-color: #ecf0f1;
}
#username {
margin-top: 250px;
margin-bottom: inherit;
margin-right: inherit;
width: 250px;
height: 35px;
font-size: 20px;
font-family: 'Droid Sans', serif;
border: 0px solid;
background-color: transparent;
}
#username:focus {
outline: none;
}
#password {
margin-top: 5px;
margin-bottom: inherit;
margin-right: inherit;
width: 250px;
height: 35px;
font-size: 20px;
font-family: 'Droid Sans', serif;
border: 0px solid;
background-color: transparent;
}
#password:focus {
outline: none;
}
#submit {
margin-top: 35px;
border: 0;
background: url(submit1.png);
background-repeat: no-repeat;
width: 200px;
height: 50px;
border: 0;
}
#submit:focus {
outline: none;
}
#submit:hover {
background-image: url(submit2.png);
}
#footer {
clear: both;
position: relative;
z-index: 5;
margin-top: 17em;
background-color: transparent;
font-family: 'Roboto', serif;
color: #bdc3c7;
height: 20px;
font-size: 10px;
}
<div id="main">
<div id="login">
<form action="Scripts/xxx.php">
<img src="border_transparent.png">
<input id="username" type="text" name="username" placeholder="Enter Username" />
<br>
<input id="password" type="password" name="password" placeholder="Enter Secret Password" />
<br>
<button id="submit" value="" />
</form>
</div>
</div>
<div id="container">
<div id="content"></div>
</div>
<div id="footer">© Project Blackhat Operatives 2015</div>
This is currently how my page looks: http://s7.postimg.org/vvfi8m1uj/Screen_Shot_2015_01_11_at_7_07_21_PM.png
This is what I am trying for the page to look like: http://s11.postimg.org/avy2caylv/Screen_Shot_2015_01_11_at_7_09_01_PM.png
It is centered, the issue is the background image behind it that you are absolute positioning. That isn't centered, you can add left: 50% and a negative margin to bring it back to the center (left positions it from the corner not the center):
img {
z-index: -1;
width: 350px;
height: 200px;
background-size: cover;
position:absolute;
left: 50%; //add
margin: 200px 0 0 -175px; //add
}
FIDDLE
What you should be doing though is adding that image as a background-image to either your form or #login containers. Positioning an img tag is not a great way of handling this.
Try
#submit:hover {
background-image: url("submit2.png");
}
Need quotes/double quotes.