So, I am using UIKit and thought I'd be "smart". So, I turned it into a .php file, added style tags, and included it in my page. Apparently, that was a very bad idea. With the 12,241 lines of code being inserted into every page, my site won't even barely load. I am trying to make a select theme option for my users. So, I do it this way:
// Retrieve theme data
$query //to select theme information, such as colors
// Example of how this data is used
<style>
.uk-input,
.uk-select,
.uk-textarea {
/* 1 */
max-width: 100%;
/* 2 */
width: 100%;
/* 3 */
border: 0 none;
/* 4 */
padding: 0 10px;
background: #<?php echo $theme_color1; ?>; // RETRIEVED FROM DB
color: #<?php echo $theme_color3; ?>; // RETRIEVED FROM DB
border: 1px solid #<?php echo $theme_color2; ?>; // RETRIEVED FROM DB
transition: 0.2s ease-in-out;
transition-property: color, background-color, border;
}
</style>
So, this is a very bad way of doing it when the CSS is so large. Can anyone advise me on the correct way to make a select theme option for my users? I would greatly appreciate it.
<style>--color1: <?php echo $theme_color1; ?></style>CSS file:body { background-color:var(--color1);}<style>:root { --main-bg-color: <?php echo $theme['bg']; ?>; --main-txt-color: <?php echo $theme['txt']; ?>; }</style>You missed selector. Some browser does not support caniuse.com/#feat=css-variables