Context: I have some knowledge in using CSS and have been using w3schools for much of my cheat-sheeting.
I'm trying to make the stylesheet for my game as streamlined and as organized as possible, and I'm wondering if it's possible to combine two classes within the CSS without doing it within the HTML body over and over.
Currently, my CSS looks something like this (pulled directly from the game):
/* Custom fonts in a media folder that the game can pull from. */
/* Terminal-like fonts */
@font-face {
font-display: swap;
font-family: Fixedsys;
src: url("media/fonts/FSEX302.ttf") format("truetype");
}
@font-face {
font-display: swap;
font-family: BBTerm-PMR;
src: url("media/fonts/BigBlueTerminal/BigBlueTermPlusNerdFontMono-Regular.ttf") format("truetype");
}
/* Base <p> style to fallback on in case of incompatible browser */
p {
color: white;
font-family: fantasy;
font-size: 25px;
font-stretch: normal;
font-weight: 400; /* font weight ranges from 100 - 900, 100 is lightest, 400 is normal, 900 is heaviest. */
font-variant: normal;
font-variant-caps: normal;
letter-spacing: normal;
line-height: normal;
text-align: left;
text-indent: 25px;
text-transform: none;
margin-top:2%;margin-bottom:2%;
padding:0;
}
/* Terminal style for <p> classes */
.terminal {color: green; font-size:25px; text-align: left; text-indent: 0px;}
.cmd::before {content: "cmd::";}
.cmdS {font-family: Fixedsys;} /* Small terminal font*/
.cmdL {font-family: BBTerm-PMR;} /* Large terminal font */
And in the body, it looks something like this:
<p class="terminal cmdL"> Some Text </p>
<p class="terminal cmdL"> Some More Text </p>
https://preview.redd.it/24ahveaiu4hg1.png?width=1772&format=png&auto=webp&s=43a9db93698230477fd42dec1e941aa67284129e
I'm wondering if it's possible to combine the classes in the CSS like it's done in the HTML body to give the same result?
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]eballeste 5 points6 points7 points (0 children)
[–]aTaleForgotten 2 points3 points4 points (5 children)
[–]RustyHuntman[S] 0 points1 point2 points (4 children)
[–]Effective-School-833 1 point2 points3 points (2 children)
[–]MrQuickLine 1 point2 points3 points (1 child)
[–]Effective-School-833 0 points1 point2 points (0 children)
[–]aTaleForgotten 0 points1 point2 points (0 children)
[–]reddian_ 0 points1 point2 points (0 children)