CSS file is only running part of the code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cloudytechi147
    New Member
    • Nov 2021
    • 2

    CSS file is only running part of the code

    I'm building a website, but my HTML and CSS are bugging me. When I load my website through Github Pages, or through local files, I can see my HTML and it all works perfectly fine. The problem is, only part of my CSS is loading.

    On my website, I made a sidebar, and when I tested it through local files it worked fine. Yesterday I opened Notepad++ (I can't install VSCode on this computer) and opened my website to test what size font was the best.

    When I opened it, some of the CSS didn't work. My background image is gone, and my sidebar was moved to under my text, and also it expanded the entire screen. Also, all of my colours were removed from my sidebar. I tried this with GitHub pages, but it was also bugged there with defect tracking tools.

    Some of my CSS is still working, but around half is not working. I made a new CSS and HTML document and copied all of the code, changing the link and it was still bugged.

    Code:
    <html> 
    <head>
    <link rel="stylesheet" href="GithubTestCSS.css">
            
        <h1 style="text-align:center; color: #fff; font-size: 40px;  font-family: Comic Sans MS; margin-left: 425px; "> Text <h1>
            <div class="main-text">
                <p> text</p>
                <p> text</p>
                <p> text </p>
                <p> text </p>
                <p> text </p>
            
            </div>
    
    </head>
    <body>
    
      <header class="header" role="banner">
      
      <div class="logo">
        <a href="#">Home</a>
      </div>
      
      <div class="nav-wrap">
        <nav class="main-nav" role="navigation">
        
          <ul class="unstyled list-hover-slide">
          
            <li><a href="#">Poems</a></li>
            <li><a href="#">Collages</a></li>
            <li><a href="#">Art</a></li>
            <li><a href="#">Infographics</a></li>
            
          </ul>
          
        </nav>
       </div>
       
    </head>
    </body>
    </html>
    Code:
      
      .bg-text {
      position: center;
      background-color: rgb(0,0,0); /* Fallback color */
      background-color: rgba(0,0,0, 0.6); /* Black w/ slight opacity see-through */
      color: white;
      font-weight: bold;
      font-size: 28px;
      border: 5px solid #f1f1f1; 
      position: fixed;
      margin-right: 50px;
      margin-top: 50px;
      margin-bottom: 20px;
      padding: 5px; 
    }
     
      
      
      
      
      .unstyled a {
        text-decoration: none;
      }
      
      .list-inline {
        overflow: hidden;
      }
      .list-inline li {
        float: left;
      }
      
      
      .logo {
        font: 100 1em "Source Sans Pro", Helvetica, Arial, sans-serif;
        text-align: center;
        padding: 0;
        margin: 0;
      }
      
      /* The logo (top of sidebar*/
      
      .logo a {
        display: block;
        padding: 1em 0;
        color: #03A062;
        text-decoration: none;
        transition: .75s linear color;
      }
      
      
      /* The sidebar */
      
      .main-nav ul {
        border-top: solid 1px #3C3735;
      }
      .main-nav li {
        border-bottom: solid 1px #3C3735;
      }
      .main-nav a {
        padding: 1.1em 0;
        color: #03A062;
        font: 400 1.125em "Source Sans Pro", Helvetica, Arial, sans-serif;
        text-align: center;
      }
      .main-nav a:hover {
        color: #03A062;
      }
      
      
      .list-hover-slide li {
        position: relative;
        overflow: hidden; 
      }
      .list-hover-slide a {
        display: block;
        position: relative;
        z-index: 1;
        transition: .75s ease color;
      }
      .list-hover-slide a:before {
        content: '';
        display: block;
        z-index: -1;
        position: absolute;
        left: -100%;
        top: 0;
        width: 100%;
        height: 100%;
        border-right: solid 5px #03A062;
        background: #3C3735;
        transition: .75s ease left;
      }
      .list-hover-slide a.is-current:before, .list-hover-slide a:hover:before {
        left: 0;
      } 
      .testing-text{
          text-align: center;
          color: #fff;
      }
    Please help me in this
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32636

    #2
    Hi CloudyTechi.

    Welcome to Bytes.com.

    Your post seems fine but you must post technical questions in the appropriate forum. They are never allowed in the Lounge - which is where members hang out and chill, away from all the questions.

    Good luck with your question here.

    -Ade (Admin).
    Last edited by NeoPa; Jan 24 '22, 03:38 PM.

    Comment

    • dev7060
      Recognized Expert Contributor
      • Mar 2017
      • 655

      #3
      Code:
       
      <html> 
      <head>
      <link rel="stylesheet" href="GithubTestCSS.css">
       
          <h1 style="text-align:center; color: #fff; font-size: 40px;  font-family: Comic Sans MS; margin-left: 425px; "> Text <h1>
              <div class="main-text">
                  <p> text</p>
                  <p> text</p>
                  <p> text </p>
                  <p> text </p>
                  <p> text </p>
       
              </div>
       
      </head>
      <body>
       
        <header class="header" role="banner">
       
        <div class="logo">
          <a href="#">Home</a>
        </div>
       
        <div class="nav-wrap">
          <nav class="main-nav" role="navigation">
       
            <ul class="unstyled list-hover-slide">
       
              <li><a href="#">Poems</a></li>
              <li><a href="#">Collages</a></li>
              <li><a href="#">Art</a></li>
              <li><a href="#">Infographics</a></li>
       
            </ul>
       
          </nav>
         </div>
       
      </head>
      </body>
      </html>
      Code:
       
        .bg-text {
        position: center;
        background-color: rgb(0,0,0); /* Fallback color */
        background-color: rgba(0,0,0, 0.6); /* Black w/ slight opacity see-through */
        color: white;
        font-weight: bold;
        font-size: 28px;
        border: 5px solid #f1f1f1; 
        position: fixed;
        margin-right: 50px;
        margin-top: 50px;
        margin-bottom: 20px;
        padding: 5px; 
      }
       
       
       
       
       
        .unstyled a {
          text-decoration: none;
        }
       
        .list-inline {
          overflow: hidden;
        }
        .list-inline li {
          float: left;
        }
       
       
        .logo {
          font: 100 1em "Source Sans Pro", Helvetica, Arial, sans-serif;
          text-align: center;
          padding: 0;
          margin: 0;
        }
       
        /* The logo (top of sidebar*/
       
        .logo a {
          display: block;
          padding: 1em 0;
          color: #03A062;
          text-decoration: none;
          transition: .75s linear color;
        }
       
       
        /* The sidebar */
       
        .main-nav ul {
          border-top: solid 1px #3C3735;
        }
        .main-nav li {
          border-bottom: solid 1px #3C3735;
        }
        .main-nav a {
          padding: 1.1em 0;
          color: #03A062;
          font: 400 1.125em "Source Sans Pro", Helvetica, Arial, sans-serif;
          text-align: center;
        }
        .main-nav a:hover {
          color: #03A062;
        }
       
       
        .list-hover-slide li {
          position: relative;
          overflow: hidden; 
        }
        .list-hover-slide a {
          display: block;
          position: relative;
          z-index: 1;
          transition: .75s ease color;
        }
        .list-hover-slide a:before {
          content: '';
          display: block;
          z-index: -1;
          position: absolute;
          left: -100%;
          top: 0;
          width: 100%;
          height: 100%;
          border-right: solid 5px #03A062;
          background: #3C3735;
          transition: .75s ease left;
        }
        .list-hover-slide a.is-current:before, .list-hover-slide a:hover:before {
          left: 0;
        } 
        .testing-text{
            text-align: center;
            color: #fff;
        }
      - Why are lines 6-14 inside the head?
      - Why use inline CSS in line 6? Where's the closing h1?
      - Where's the closing header of line 19?
      - There's no code that specifies the background image.
      - What's with the extra </head> in line 40?

      Describe or show the expected result and arrangement.

      Comment

      Working...