Can you fix this css please!

Asked

Viewed 52 times

-4

I used CSS of this link, but they made a lot of mistakes: Link 1 Link 2 Link 3

import "bourbon";

break-medium: 980px;
nav-width: 240px;
site-width: 1600px;

@import url(https://fonts.googleapis.com/css?family=Open+Sans:700,300,600,800,400);

html,
body {
  margin: 0;
  padding: 0;
  background: lighten(#3a4043, 15%);
  font-family: 'Open Sans', sans-serif;
}

.l-site {
  margin: 0 auto;
  max-width: site-width;
  position: relative;
  z-index: 1;

  before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 50%;
    display: block;
    background: #3a4043;
    z-index: 1;
  }
}

.l-page {
  position: relative;
  margin-left: nav-width;
  background: #fff;
  z-index: 2;
  box-shadow: 1px 0 25px rgba(0,0,0,0.25);
  @include transition(0.35s);
}

.l-nav {
  position: absolute;
  width: nav-width;
  display: block;
  background: #3a4043;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
}

.band {
  h1 {
    margin: 0;
    padding: 0 0 10px;
    color: #fff;
    font-size: 32px;
  }

  p {
    margin: 0;
    padding: 0;
    color: #fff;
    font-size: 17px;
  }
}

.band-container {
  left: 0;
  right: 0;
  margin: 0 auto;
  min-height: 85vh;
  max-width: 960px;
  display: table;
  position: relative;
  padding: 0 3em;
}

.band-inner {
  display: table-cell;
  vertical-align: middle;
  padding: 3em 0 4em;
}

.band-a {
  background: #69D2E7;
}

.band-b {
  background: #F9D423;
}

.band-c {
  background: #F38630;
}

.band-d {
  background: #FF4E50;
}

.nav {
  width: (nav-width - 60);
  position: fixed;
  top: 0;
  bottom: 0;
  margin: 0;
  padding: 30px;
  overflow: auto;

  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li {
    margin: 0;
    padding: 0;
    @include transition(0.25s);
  }

  a {
    color: #fff;
    text-decoration: none;
    font-size: 20px;
    font-weight: 800;
    display: block;
    padding: 10px 0;
  }

  .nav-primary {
    opacity: 1;

    :hover {
      opacity: 0.7;
    }
  }

  .nav-secondary {
    opacity: 0.4;

    :hover {
      opacity: 0.7;
    }
  }
}

.menu {
  display: none;
  position: fixed;
  top: 25px;
  left: 1.5em;
  width: 24px;
  height: 24px;
  cursor: pointer;
  z-index: 10;

  hover {
    .menu-hamburger:before,
    .menu-hamburger:after {
      width: 24px;
    }
  }

 .is-active {
    .menu-hamburger {
      background: none;
    }
    .menu-hamburger:before,
    .menu-hamburger:after {
      top: 0;
      width: 24px;
      -webkit-transform: rotate(45deg);
          -ms-transform: rotate(45deg);
              transform: rotate(45deg);
    }
    .menu-hamburger:after {
      -webkit-transform: rotate(-45deg);
          -ms-transform: rotate(-45deg);
              transform: rotate(-45deg);
    }
    .menu-hamburger:hover {
      -webkit-transform: scale(1.2);
          -ms-transform: scale(1.2);
              transform: scale(1.2);
    }
  }
}

.menu-hamburger {
  position: relative;
  width: 24px;
  height: 4px;
  margin: 10px 0;
  background: #fff;
  border-radius: 4px;
  transition: all 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

  before,
  after {
    content: '';
    display: block;
    width: 24px;
    height: 4px;
    background: #fff;
    position: absolute;
    border-radius: 4px;
    transition: all 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  }
  before {
    top: -8px;
    left: 0;
    width: 22px;
  }

  :after {
    top: 8px;
    width: 16px;
    left: 0;
  }
}

@media screen and (max-width: break-medium) {
  .menu {
    display: block;
  }

  .l-site {
    .is-open {
      overflow: hidden;

      .l-page {
        @include transform(translateX(nav-width));
      }
    }
  }

  .l-page {
    margin-left: 0;
    z-index: 3;
  }

  .l-nav {
    z-index: 2;
  }

  .band-container {
    padding: 0 1.5em;
  }
}

1 answer

3

The problem there is that you are not closing the keys {}. Like you said it is CSS, there can be no elements within other elements, this way that is written, is only accepted in pre-processed CSS as LESS or SASS for example.

WRONG

.band {
   h1 {                   <- PROBLEMA AQUI
     margin: 0;
     padding: 0 0 10px;
     color: #fff;
     font-size: 32px;
   }

   p {
    margin: 0;
    padding: 0;
    color: #fff;
    font-size: 17px;
  }
}

CORRECT

h1 {                      <- ELEMENTO ABRE
   margin: 0;
   padding: 0 0 10px;
   color: #fff;
   font-size: 32px;
}                          <- ELEMENTO FECHA

p {                        <- ELEMENTO ABRE
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: 17px;
}                          <- ELEMENTO FECHA
  • that’s all??????

  • Look, I went to check my code and all the keys are locked!

  • 1

    You’re nesting rules inside each other and it’s not possible to do that with CSS. Are you sure you wrote CSS, it wouldn’t be SCSS?

  • no, I want css, could you send me the right code, please?

  • thanks but now, what I do here:; &#xA; break-medium: 980px;&#xA;nav-width: 240px;&#xA;site-width: 1600px;&#xA;and here ``` Hover { . menu-hamburger:before, . menu-hamburger:after { width: 24px; } }``

  • You are probably writing in some preprocessor, I am not understanding why you want to rewrite it in CSS, because it will be compiled and transformed into CSS.

  • You’re looking at this link Link the css part is the one I took, but when I went to visual studio code, it started giving errors!

  • 3

    The code is not wrong, it’s just not CSS. @include transition(0.35s); is a mixin. You copied this code that somewhere and is not knowing what it is. try to put your code in a online compiler to have the CSS ready.

  • 1

    José, on this link you just sent, you can click on the CSS menu and click on View Compiled CSS.

  • 3

    And it is written that it is SCSS, lacked attention.

  • okay, thank you!!!

  • but wait, I have to take the & and $ code?

  • What do I have to do to get the mixin?

Show 8 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.