Click here to Skip to main content
15,882,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was styling some images in sass as nothing is happening to them even that code is compiled in css too.





This the html portion of that images.

<div class="composotion">

      <img src="img/nat-1-large.jpg" alt="Photo 1" class="composition_photo composition_photo--p1">

      <img src="img/nat-2-large.jpg" alt="Photo 2" class="composition_photo composition_photo--p2">

      <img src="img/nat-3-large.jpg" alt="Photo 3" class="composition_photo composition_photo--p3">

  </div>





Now, the sass portion of those images.


.composotion {

   position: relative; 

   &__photo {
       width: 20%;
     
       position: absolute;

       

       &--p1 {
        left: 0;
        top: -2rem;


    }

    &--p2 {
        right: 0;
        top: 2rem;


    }

    &--p3 {
        left: 20%;
        top: 10rem;


        }

   
}
}




And still nothing is working.Please help me so i can get out of this river.

What I have tried:

I tried to change every thing the code and when i remove everything except the width then it works a little bit but not wholly ...
Posted
Updated 13-Sep-18 9:58am

1 solution

The compiled CSS is:
CSS
.composotion {
  position: relative;
}
.composotion__photo {
  width: 20%;
  position: absolute;
}
.composotion__photo--p1 {
  left: 0;
  top: -2rem;
}
.composotion__photo--p2 {
  right: 0;
  top: 2rem;
}
.composotion__photo--p3 {
  left: 20%;
  top: 10rem;
}

Note the double underscores in the photo class names. Your HTML only has a single underscore.

Either change &__photo to &_photo, or change your photo class names to match the generated class names - eg: class="composition__photo composition__photo--p1"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900