Pavindu
Pavindu

Reputation: 3112

How to comment styles inside <style jsx> tag in NextJS

In CSS, you can comment out code using /* */.How to comment code inside style jsx in NextJS.I searched for this on the Internet but nothing was found.

<style jsx>{`
      table,th,td{
           border: 2px solid black;
      }

      #OOP{
        //height: 10vh;
        /*background-color: #28DE65;*/
  //Both of these comment styles doesn't work inside style jsx
      }
`}</style>

Upvotes: 1

Views: 2478

Answers (2)

Ganapati V S
Ganapati V S

Reputation: 1661

CSS commenting works in <style jsx> in next.js. You might have missed/misconfigured something.

Demo 👇

Edit hello-world

Upvotes: 1

Sau
Sau

Reputation: 35

You can prefix by _, it's not a comment but attribut are not interpreted :

<style jsx>{`
      table,th,td{
           border: 2px solid black;
      }

      #OOP{
        __height: 10vh;
        __background-color: #28DE65;
      }
`}</style>

Not elegant solution, but it works ;-)

Upvotes: 1

Related Questions