+ 1
How to style the <script> tag?
23 Respuestas
+ 4
you don't need to style a script tag
because the codes within script pairs will be interpreted By JavaScript and executed.
+ 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
+ 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
+ 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>");
+ 2
Just to make it a little easier to help out, could you share the code you're having troubles with?
+ 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.
+ 2
Sorry, could you clarify what you mean?
+ 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 🤷♂️
+ 1
Nueva Peloni
As in, a circle?
0
Why I don't need? If I want to color a text written using document.write?
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.
0
I mean for example color a string written using document.write
0
Faisal but what when I got to color a hole programe?
0
Faisal I want to color the background of a digital clock
0
I tried with div="" and then in CSS .""{}but it doesn't work
0
Ok
https://code.sololearn.com/W32m6CJV30Jv/?ref=app
The code is here
0
I am trying to color the background of the clock but I can't
0
Thanks
0
What if I want to color not all the body or add other characteristics like size?