I want to use a dynamic bootstrap calendar in a website I am building. I have a style sheet for my site, but the calendar has its own styles, and no matter what I do something from one sheet ruins the other elements (my header is ruined by the calendar stylesheet, and the calendar becomes wonky and asymmetrical because of my stylesheet.)
I tried putting a class in a class (below) and giving that class to a div and putting the calendar code inside it but it did not work.
.calendar_content{
sub {
bottom: -.25em; }
sup {
top: -.5em; }
a {
color: #007bff;
text-decoration: none;
background-color: transparent; }
a:hover {
color: #0056b3;
text-decoration: underline; }
a:not([href]):not([tabindex]) {
color: inherit;
text-decoration: none; }
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
color: inherit;
text-decoration: none; }
a:not([href]):not([tabindex]):focus {
outline: 0; }
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em; }
pre {
margin-top: 0;
margin-bottom: 1rem;
overflow: auto; }
}
<div class="calendar_content"> Calendar code </div>
I also tried using id (below) but it didn’t work either.
CSS: #calendar_content{the entire stylesheet content}
HTML: <div id="calendar_content"> Calendar code </div>
Additional info: there are js files involved but I don’t believe it’s affecting the view of the site.
2
Answers
if you are using react/nextjs you just import the css file in the calendar component as module
if you are using native html/css , you will need to use sass/scss/less to be able to use syntax like class nesting ex:
While you can by prefixing each CSS rule to support situations that do not support the nested CSS or avoid SCSS or SASS etc. this can get ugly.