Thursday, September 14, 2023
HomeCSSjavascript - Why is the top fifty percent not lined up with...

javascript – Why is the top fifty percent not lined up with the reduced fifty percent of the card


// Fits and also worths for the cards
const fits =['♤', '♡', '♧', '♢']
const cardRanks =['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'C', 'Q', 'K']


feature createCard( fit, ranking) {
allow card = document.createElement(' card').

card.setAttribute(' fit', fit).
card.setAttribute(' ranking', ranking).

for (i = 0; i < {
deck.push( createCard( fit, ranking)).
} ).
} ).

const deckElement = document.querySelector('. deck').
deck.forEach( card => > {deckElement.appendChild( card)} )[]: origin {
-- card-size-unit: calc( 100vw/75);.
-- white: #fff;.
-- black: # 000;.
-- red: #f 00;.
}

body {
background-color: rgb( 14, 68, 4);.
margin: 0;.
}

. deck {
screen: flex;.
flex-wrap: cover;.
}

card {
margin:.25 em;.

border-radius: calc(.3 * var(-- card-size-unit));.
boundary: calc(.2 * var(-- card-size-unit)) strong var(-- white);.
background-color: var(-- white);.

-- card-color: var(-- black);.
}

card
, card[suit="♢"] {
-- card-color: var(-- red);.
}

card-half {
font-size: calc( 1.5 * var(-- card-size-unit));.
shade: var(-- card-color);.

screen: block;.
size: calc( 5.3 * var(-- card-size-unit));.
elevation: calc(.5 * 10.7 * var(-- card-size-unit));.

background-position-y: base;.
background-size: 100% calc( calc(.5 * 10.7 * var(-- card-size-unit)) - calc( 2 * var(-- card-size-unit)));.
background-repeat: no-repeat;.

boundary: calc(.1 * var(-- card-size-unit)) strong var(-- black);.
border-bottom: 0 strong var(-- white);.
border-radius: calc(.3 * var(-- card-size-unit)) calc(.3 * var(-- card-size-unit)) 0 0;.
}

card[suit="♡"] card-half {
text-align: facility;.
}

card: not([suit="T"]) {
text-indent: 3px;.
}

card-half. half-1 {
change: range( -1, -1);.
} [suit="T"]<. << html lang=" en">
<> < head>>.
<< meta charset=" UTF-8">
<> < meta name=" viewport" material=" size= device-width, initial-scale= 1.0">>.
<< web link rel=" stylesheet" href=" https://stackoverflow.com/questions/76846200/cardStyle.css">
<> < manuscript kind=" text/javascript" src=" genCards.js" postpone><> .
<< title>> Card examination<. <. << body>>.
<

RELATED ARTICLES

Most Popular

Recent Comments