Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do i style the output of a javascript output

Featured Replies

Hi!

 

IT'S FRIDAY!!! WOOHOO

 

Anyway down to business... ok with a simple javascript method like date, it outputs the date, and that's cool, but it's black writing and i am using a black background, so i would like to make it white! But just as a general learning process i was wondering how you can style the output of javascript functions and stuff?

 

I would really appreciate your help on this one! Thanks

 

 

p.s the code you need to output the date in a website is below if you want to experiment ;p

 

 

 

 

 

 

<html>

<body>

 

<script type="text/javascript">

 

document.write(Date());

 

</script>

</body>

</html>

Hi

 

If you put it in its own div class it should be fine

 

<div class="white">

<script type="text/javascript">

 

document.write(Date());

 

</script>

</div>

 

Then css like

 

.white {

color:#FFFFFF;

}

 

 

Pat

  • Author

AH YES!!!!

 

Nice one mate, you have made my day!

 

Thank you!

 

I love learning new things! :clapping:

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.