Home > other >  Odd issues with CSS that worked yesterday no longer working... completely
Odd issues with CSS that worked yesterday no longer working... completely

Time:12-24

I am using the w3.css css file along with the google icons woff2 file to design an HTML page, I am also using a raspberry pi with a python file running flask for the web server, the server is running correctly and yesterday everything looked great. Today I get on and it seems that the HTML isn't properly displaying the icons unless I move the css code for them from the css file to inside a style element in the HTML file.

Everything else from the css file is still working correctly, if I delete it the page looks very wrong, I am very frustrated trying to figure out what I must have accidentally changed to where most of the css page is being linked to properly but the parts referring to the icons only work within the HTML...

Any help would be greatly appreciated, the icons are the only thing not displaying correctly at the moment and if all else fails I can just move the code to my HTML file again. Im sure its stupid and simple and I'm going to hate myself for not being able to spot such a simple mistake. Large portions of the w3.css need to be removed to not have too many words, the top 235 lines are exactly the same as what the file off the website has so the only css in question is at the very bottom of the css code separated from the w3css code--edit-- this site did something odd combining the style element from in the html file with the css file

a.custom-hover-color:hover { 
  background-color: transparent!important;
  text-color: black!important;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}
input:checked   .slider {
  background-color: #2196F3;
}
input:focus   .slider {
  box-shadow: 0 0 1px #2196F3;
}
input:checked   .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}

/* W3.CSS 4.15 December 2020 by Jan Egil and Borge Refsnes */
html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}
/* Extract from normalize.css by Nicolas Gallagher and Jonathan Neal git.io/normalize */
html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}
article,aside,details,figcaption,figure,footer,header,main,menu,nav,section{display:block}summary{display:list-item}
audio,canvas,progress,video{display:inline-block}progress{vertical-align:baseline}
audio:not([controls]){display:none;height:0}[hidden],template{display:none}
a{background-color:transparent}a:active,a:hover{outline-width:0}
abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}
b,strong{font-weight:bolder}dfn{font-style:italic}mark{background:#ff0;color:#000}
small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
sub{bottom:-0.25em}sup{top:-0.5em}figure{margin:1em 40px}img{border-style:none}
code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}hr{box-sizing:content-box;height:0;overflow:visible}
button,input,select,textarea,optgroup{font:inherit;margin:0}optgroup{font-weight:bold}
button,input{overflow:visible}button,select{text-transform:none}
button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}
button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}
button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}
fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em}
legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}
[type=checkbox],[type=radio]{padding:0}
[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}
[type=search]{-webkit-appearance:textfield;outline-offset:-2px}
[type=search]::-webkit-search-decoration{-webkit-appearance:none}
::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}
/* End extract */
html,body{font-family:Verdana,sans-serif;font-size:15px;line-height:1.5}html{overflow-x:hidden}
h1{font-size:36px}h2{font-size:30px}h3{font-size:24px}h4{font-size:20px}h5{font-size:18px}h6{font-size:16px}
.w3-serif{font-family:serif}.w3-sans-serif{font-family:sans-serif}.w3-cursive{font-family:cursive}.w3-monospace{font-family:monospace}
h1,h2,h3,h4,h5,h6{font-family:"Segoe UI",Arial,sans-serif;font-weight:400;margin:10px 0}.w3-wide{letter-spacing:4px}
hr{border:0;border-top:1px solid #eee;margin:20px 0}

.w3-cell-top{vertical-align:top}.w3-cell-middle{vertical-align:middle}.w3-cell-bottom{vertical-align:bottom}
.w3-hide{display:none!important}.w3-show-block,.w3-show{display:block!important}.w3-show-inline-block{display:inline-block!important}
@media (max-width:1205px){.w3-auto{max-width:95%}}
@media (max-width:600px){.w3-modal-content{margin:0 10px;width:auto!important}.w3-modal{padding-top:30px}
.w3-dropdown-hover.w3-mobile .w3-dropdown-content,.w3-dropdown-click.w3-mobile .w3-dropdown-content{position:relative}  
.w3-hide-small{display:none!important}.w3-mobile{display:block;width:100%!important}.w3-bar-item.w3-mobile,.w3-dropdown-hover.w3-mobile,.w3-dropdown-click.w3-mobile{text-align:center}
.w3-dropdown-hover.w3-mobile,.w3-dropdown-hover.w3-mobile .w3-btn,.w3-dropdown-hover.w3-mobile .w3-button,.w3-dropdown-click.w3-mobile,.w3-dropdown-click.w3-mobile .w3-btn,.w3-dropdown-click.w3-mobile .w3-button{width:100%}}
@media (max-width:768px){.w3-modal-content{width:500px}.w3-modal{padding-top:50px}}
@media (min-width:993px){.w3-modal-content{width:900px}.w3-hide-large{display:none!important}.w3-sidebar.w3-collapse{display:block!important}}
@media (max-width:992px) and (min-width:601px){.w3-hide-medium{display:none!important}}
@media (max-width:992px){.w3-sidebar.w3-collapse{display:none}.w3-main{margin-left:0!important;margin-right:0!important}.w3-auto{max-width:100%}}
.w3-border-pale-yellow,.w3-hover-border-pale-yellow:hover{border-color:#ffffcc!important}.w3-border-pale-blue,.w3-hover-border-pale-blue:hover{border-color:#e7ffff!important}/* fallback */



@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    src: url(icons/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}

.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}
<!DOCTYPE html>
<html lang="en" style="--app-height:px;" class>
    <meta name="author" content="Travis Grudzinskas">
    <title>Catbot</title>
    <link rel="stylesheet" href="/static/style.css">
    <style>
        html,body,h1,h2,h3,h4,h5 {font-family: "Raleway", sans-serif}
    </style>
    <script src="/static/script.js"></script>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale-1.0">
    <meta name="description" content="Catbot, the popular bot for cats">
    <link rel="icon" type="image/png" sizes="32x32" href="/static/catbot_black.png">
    <meta name="theme-color" content="#121212">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Catbot">
    <link rel="apple-touch-icon" sizes="180x180" href="/static/catbot_black.png">

<style></style>

<!--navigation-->
<div >
    <div  style="display:none" id="mySidebar">
      <button onclick="w3_close()" >Close &times;</button>
      <a href="#index.html" >Dashboard</a>
      <a href="#Recordings" >Recordings</a>
      <a href="#machine.html" >Machine</a>
    </div>
    <div >
    <button   onclick="w3_open()">☰</button>
    <img  href="/static/catbot_white.png">
    </div>
    <!--right sided nav links-->
    <div >
        <a href="#notifications" ><i >flag</i></a>
        <a href="#interface" ><i >settings</i></a>
        <a href="#power" ><i >power_settings_new</i></a>
    </div>
</div>
</div>
<body style="padding-top: 70px; background-color: #009688; text-align: center;">
    <div >
        <div >
            <h1>simulated position</h1>
            <img src="/plot" alt="simulated position plot" width="49%">
        </div>
        <div  style="text-align: center;">
            <h1>Controls</h1>
            <div  style="padding-top: 1%;">
                <p>Sentient/Manual</p>
        <h2><label ><input type="checkbox">
        <span ></span></label></h2>
            </div>
            <div >
                <div >
                    <p>counter-clockwise</p>
            <p><a  style="font-size: xxx-large">arrow_circle_left</a></p>
                </div>
                <div >
                    <p>actuate</p>
            <p><a  style="font-size: xxx-large">pets</a></p>

                </div>
                <div >
                    <p>clockwise</p>
            <p><a  style="font-size: xxx-large">arrow_circle_right</a></p>
                </div>
            </div>
        </div>
    </div>
    <div  style="padding-top: 1%;">
        <div >
            <h1>Console</h1>
        </div>
        <div id="cameras"  style="text-align: center;">
            <h1>Cameras</h1>
            <video autoplay title="LiveStream" width="320" height="240" controls>
            <source src="/static/Octopus.mp4" type="video/mp4">
            Your browser does not support the video tag.
            </video>
        </div>
    </div>
    <script>
        function w3_open() {
          document.getElementById("mySidebar").style.display = "block";
        }
        
        function w3_close() {
          document.getElementById("mySidebar").style.display = "none";
        }
    </script>
</body>
</html>

I have tried completely re-downloading the css file and redoing the code for the icons, thought it would fix any mistakes I accidentally saved but it did not work

I moved the code to inside the "style" element in the html file and it did make the icons work properly, so the location of the icon file isn't the problem, I would like to clean up the HTML file and have less css in it if possible though

I have scanned through my code and clawed my eyes out hoping the blood sweat and tears would lead to something

CodePudding user response:

Looking through the CSS a good idea might be to try removing some, as I think conflicts and specificity are the source of the problem. For example, there are three different font-family declarations.

I would try removing the minified section below first and see if that solves the issue. For what you are doing it seems like it would be unnecessary.

/* W3.CSS 4.15 December 2020 by Jan Egil and Borge Refsnes */
html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}
/* Extract from normalize.css by Nicolas Gallagher and Jonathan Neal git.io/normalize */
html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}
article,aside,details,figcaption,figure,footer,header,main,menu,nav,section{display:block}summary{display:list-item}
audio,canvas,progress,video{display:inline-block}progress{vertical-align:baseline}
audio:not([controls]){display:none;height:0}[hidden],template{display:none}
a{background-color:transparent}a:active,a:hover{outline-width:0}
abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}
b,strong{font-weight:bolder}dfn{font-style:italic}mark{background:#ff0;color:#000}
small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
sub{bottom:-0.25em}sup{top:-0.5em}figure{margin:1em 40px}img{border-style:none}
code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}hr{box-sizing:content-box;height:0;overflow:visible}
button,input,select,textarea,optgroup{font:inherit;margin:0}optgroup{font-weight:bold}
button,input{overflow:visible}button,select{text-transform:none}
button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}
button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}
button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}
fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em}
legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}
[type=checkbox],[type=radio]{padding:0}
[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}
[type=search]{-webkit-appearance:textfield;outline-offset:-2px}
[type=search]::-webkit-search-decoration{-webkit-appearance:none}
::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}
/* End extract */
html,body{font-family:Verdana,sans-serif;font-size:15px;line-height:1.5}html{overflow-x:hidden}
h1{font-size:36px}h2{font-size:30px}h3{font-size:24px}h4{font-size:20px}h5{font-size:18px}h6{font-size:16px}
.w3-serif{font-family:serif}.w3-sans-serif{font-family:sans-serif}.w3-cursive{font-family:cursive}.w3-monospace{font-family:monospace}
h1,h2,h3,h4,h5,h6{font-family:"Segoe UI",Arial,sans-serif;font-weight:400;margin:10px 0}.w3-wide{letter-spacing:4px}
hr{border:0;border-top:1px solid #eee;margin:20px 0}

If you need to keep this section, I would move it to the top of the CSS file to limit conflicts.

CodePudding user response:

You should copy the direct path of the icons you need and then put "file://" infront of that. Since I don't see any issues in your code I think the issue is with the computer finding the path to those icons.

Ex. file://C:\Users\jbrir\Documents\website\images\light.png

  • Related