+ 1

How to style the <script> tag?

20th Jun 2019, 3:46 PM
Nueva Peloni
Nueva Peloni - avatar
23 ответов
+ 4
you don't need to style a script tag because the codes within script pairs will be interpreted By JavaScript and executed.
20th Jun 2019, 3:48 PM
Gordon
Gordon - avatar
+ 4
Rather than using document.write() to do that, what you could just do is use document.body.style.backgroundColor = "red"; for example when colouring the background in JS
20th Jun 2019, 4:07 PM
Faisal
Faisal - avatar
+ 3
If you've set your div to have an ID, you can access it by using document.getElementById("id_of_element") and manipulate its style the same way you did with the body
20th Jun 2019, 4:38 PM
Faisal
Faisal - avatar
+ 2
When it comes to using a function like document.write, you could just surround the text you want to print to the screen in HTML tags: document.write("<h1>Hello World</h1>");
20th Jun 2019, 3:52 PM
Faisal
Faisal - avatar
+ 2
Just to make it a little easier to help out, could you share the code you're having troubles with?
20th Jun 2019, 3:58 PM
Faisal
Faisal - avatar
20th Jun 2019, 4:13 PM
Gordon
Gordon - avatar
+ 2
Nueva Peloni When using document.<element>.style.<attribute>, you can essentially manipulate any element within your program using any CSS attributes you would need to manipulate. If you're looking to change the size of something, you could use document.element.style.size = "60%"; for example to change it within the JS.
20th Jun 2019, 4:19 PM
Faisal
Faisal - avatar
+ 2
Sorry, could you clarify what you mean?
20th Jun 2019, 4:21 PM
Faisal
Faisal - avatar
+ 2
If I understand what you're asking correctly, why not just create more divs? It never hurts to add more content to your website, and if that's what will help in improving certain aspects of it, then it would definitely be worth your while 🤷‍♂️
20th Jun 2019, 4:26 PM
Faisal
Faisal - avatar
+ 1
Nueva Peloni As in, a circle?
20th Jun 2019, 3:55 PM
Faisal
Faisal - avatar
0
Why I don't need? If I want to color a text written using document.write?
20th Jun 2019, 3:50 PM
Nueva Peloni
Nueva Peloni - avatar
0
If you mean you want the code to appear, you can use the tag selector “script” in CSS and set the “display” to “block” (or how you want it to appear, maybe inline, example: script{display:block;}). Then you can add any other styles to it that you want. You may want to be more specific of what you want.
20th Jun 2019, 3:52 PM
YoBoi
0
I mean for example color a string written using document.write
20th Jun 2019, 3:52 PM
Nueva Peloni
Nueva Peloni - avatar
0
Faisal but what when I got to color a hole programe?
20th Jun 2019, 3:54 PM
Nueva Peloni
Nueva Peloni - avatar
0
Faisal I want to color the background of a digital clock
20th Jun 2019, 3:57 PM
Nueva Peloni
Nueva Peloni - avatar
0
I tried with div="" and then in CSS .""{}but it doesn't work
20th Jun 2019, 3:58 PM
Nueva Peloni
Nueva Peloni - avatar
20th Jun 2019, 4:00 PM
Nueva Peloni
Nueva Peloni - avatar
0
I am trying to color the background of the clock but I can't
20th Jun 2019, 4:01 PM
Nueva Peloni
Nueva Peloni - avatar
0
Thanks
20th Jun 2019, 4:09 PM
Nueva Peloni
Nueva Peloni - avatar
0
What if I want to color not all the body or add other characteristics like size?
20th Jun 2019, 4:13 PM
Nueva Peloni
Nueva Peloni - avatar