Modify the JavaScript property document.body.style.background.
For example:
function changeBackground(color) {
document.body.style.background = color;
}
window.addEventListener("load",function() { changeBackground('red') });
Note: this does depend a bit on how your page is put together, for example if you’re using a DIV container with a different background colour you will need to modify the background colour of that instead of the document body.
Related Posts:
- SVG center horizontal and vertical line
- Can I change Bootstrap button color?
- Failed to load resource: the server responded with a status of 404 (Not Found)
- How to change CSS using jQuery?
- Angular: conditional class with *ngClass
- Remove class using jQuery
- What is the proper way to display a logo with CSS?
- How can I scroll to an element using jQuery?
- Responsive font size in CSS
- How to make a vertical line in HTML
- CSS Font Border?
- Why em instead of px?
- “Uncaught TypeError: Cannot read property ‘style’ of null at.. “
- Bootstrap Dropdown menu is not working
- CSS: center element within a element
- Set timeout for ajax (jQuery)
- How does the data-toggle attribute work? (What’s its API?)
- CSS height 100% percent not working
- Adding images to a Bootstrap Carousel with AJAX
- Uncaught TypeError: Cannot read property ‘top’ of undefined
- How to print HTML content on click of a button, but not the page?
- Bootstrap 4 Dropdown Menu not working?
- TypeError: $(…).modal is not a function with bootstrap Modal
- How to do fade-in and fade-out with JavaScript and CSS
- CSS background color not working
- jQuery toggle CSS?
- 100% DIV width is not really 100%
- CSS 3 slide-in from left transition
- How to write inside a DIV box with javascript
- CSS selectors ul li a {…} vs ul > li > a {…}
- How to get height of div in px dimension
- Bootstrap scrollable panel
- Crop the image using JavaScript
- Force div to be topmost element of any and all webpages
- Retrieve the position (X,Y) of an HTML element
- How to display raw JSON data on a HTML page
- CSS checkbox input styling
- Background color in input and text fields
- Why is jquery show() not working in example
- CSS3 opacity gradient?
- CSS3 background image transition
- Fully responsive HTML5 video
- How to create checkbox inside dropdown?
- How to change cursor from pointer to finger using jQuery?
- Positioning
element at center of screen- Adding Google Translate to a web site
- How can I remove a style added with .css() function?
- How to use aria-expanded=”true” to change a css property
- How do I clear the content of a div using JavaScript?
- WordPress how to remove blocksy theme price and put my own price
- wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i’m confused
- Automatically decrease font size for long words
- What are the options for running custom css and javascript files on a page?
- Hide Add to Cart Button
- How do I add JavaScript that will execute on all my sites in Multisite?
- Relative path instead of absolute for wp_enqueue_script
- W3 Total Cache: Load CSS asynchronously for better PageSpeed score? [closed]
- WordPress on localhost working, when sharing IP to connect receive err_connection_refused on .js and .css files
- Is there an earlier hook than login_head or login_enqueue_scripts?
- Can someone please tell me what is wrong with my plugin?
- Older isotope portfolio rows shifting downward by 1 pixel on hover
- Shrink Header Image on Scroll
- How does wp_enqueue_scripts work?
- Implementing a simple slider in code?
- Add Codepen animation as Preloader to WordPress
- Cannot set property ‘className’ of null at setThemeFromCookie
- Adding a Calculator to a WordPress Page
- Custom Plugin – CSS works, JS doesn’t
- get specific value of a array | PHP
- Post repeated when opening in overlay, how do I solve this? [closed]
- ACF Pro with SlickJS [closed]
- Link to page with posts of specific type
- Show/Hide Div for Login Mask
- Plugins not showing up for custom template
- uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
- How do I minify a plugins CSS/JS code?
- WordPress Rest Api access the header and extract stylesheets URL
- Invert porfolio item order
- How to make a function to play only on the home page?
- Overriding inline !important CSS with Javscript code snippet with media query
- Unable to use Datepicker in a table when inserting a row
- Getting click on item to open closest relevant element (popup) with jQuery
- Hide CSS class only in single post pages
- Speeding up WordPress on a Local Network
- Target a specific container to style on WordPress storefront theme
- How can I make menu items into two seperate buttons with different functions?
- WordPress Admin Thickbox: Remove Margins/Padding
- Where to find the html for WordPress site? [closed]
- Best use adding user generated JS/CSS to a theme with a plugin
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- Possible jquery / library conflict in plugin usage
- What can cause JavaScript and CSS files to be minified?
- How to keep close a sub-menu under homepage? [closed]
- Interactive maps in wordpress
- How to create and add js and css file when server is not on my PC?
- Changing when mobile menu is displayed
- How do I add JS and CSS to WP (Flatsome)
- “Plate” theme broken after update
- Active Navigation Class Based on URL on icon
- How to remove pop up on website (css changes not visible)?