Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select <script> tag in CSS?

It's not necessary, but i have tried to select <script> tag in css. But it didn't work. Why ?

<style>
    script {
        padding:80px;
        background-color:red;
    }
</style>

This should work. Because it works on other elements. But not on script tag .

<script>alert(1)</script>

And this is the tag i want to select.

like image 355
Hasibul Hasn Avatar asked Jan 23 '18 02:01

Hasibul Hasn


1 Answers

You forgot to set display property:

 script{
 display:block;
 padding:80px;
 background-color:red;
 }
<script>console.log(1)</script>
like image 95
Kosh Avatar answered Oct 10 '22 14:10

Kosh