0

i wont to duplicate the code to got works here is the full code: https://codepen.io/mosaababorkia/pen/dymVVmY you can visit the code and there you see that my media query always i was duplicate the class to change the effect of the size or other all i want when i change the varible effect all the file! i tried to add the query in the top not works for me !

$center : calc(50% - 332px + 150px);
$left : 0px;
$right : calc(100% - 282px - 30px);
$smallSize:250px;
$bigSize:300px;

.container{
width:$smallSize;
}

//i want to type the new value of the right when i arrive to display size
@media only screen and (max-width:1200px) {
    $right :calc(100% - 195px - 69px) !global;     
    $center: calc(53.5% - 334px + 150px) !global;
    $smallSize:200px !global;
    $bigSize:250px !global;
}
//this doesnt worked for me by adding global only if i retype the class inside like this
// i want a method to effect the written already in top
@media only screen and (max-width:1200px) {
    $right :calc(100% - 195px - 69px) !global;     
    $center: calc(53.5% - 334px + 150px) !global;
    $smallSize:200px !global;
    $bigSize:250px !global;

//trying to find way to not rewrite it again!
.container{
width:$smallSize;
}

}

thanks for helping !

3
  • I can't find how you render SCSS in the first place; so unless I am blind, it is codepen that renders it for you. Outside codepen, this would not work unless you have a SCSS compiler, whether loaded as a script or used as a preprocessor, since browsers don't understand SCSS. Since you could use any of a number of different approaches to using SCSS, this is not really answerable.
    – Amadan
    Commented Jul 27, 2022 at 7:44
  • If you changed your code to use sass.js for example, then you could compile your SCSS in the browser and set it as a new <style> content.
    – Amadan
    Commented Jul 27, 2022 at 7:47
  • im using sass watch extention but my problem is that i wont to rewrite in every media query the class again i want some way that give effect on all what have already written look up here in code the container class written two times i want only to write it one time and when i change value of smallSize in the mediaquery they effect automatic on container Commented Jul 27, 2022 at 7:49

0

Browse other questions tagged or ask your own question.