Javascript style color transparent

Style backgroundColor Property

The backgroundColor property sets or returns the background color of an element.

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
backgroundColor 1.0 4.0 1.0 1.0 3.5

Syntax

Return the backgroundColor property:

Set the backgroundColor property:

Property Values

Value Description
color Specifies the background color. Look at CSS Color Values for a complete list of possible color values
transparent Default. The background color is transparent (underlying content will shine through)
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: transparent
Return Value: A String, representing the background color
CSS Version CSS1

More Examples

Example

Set a background color of a specific element:

Example

Return the background color of a specific element:

Читайте также:  Java get resources directory path

Example

Return the background color of a document:

W3SCHOOLS EXAMS

COLOR PICKER

LEARN MORE:

SHARE THIS PAGE

Your Suggestion:

Thank You For Helping Us!

Your message has been sent to W3Schools.

Top 10 Tutorials

Top 10 References

Top 10 Examples

Web Certificates

W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 1999-2016 by Refsnes Data. All Rights Reserved.
Powered by W3.CSS.

Источник

Style backgroundColor Property

The backgroundColor property sets or returns the background color of an element.

See Also:

Syntax

Return the backgroundColor property:

Set the backgroundColor property:

Property Values

Value Description
color Specifies the background color. Look at CSS Color Values for a complete list of possible color values
transparent Default. The background color is transparent (underlying content will shine through)
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: transparent
Return Value: A String, representing the background color
CSS Version CSS1

Browser Support

backgroundColor is a CSS1 (1996) feature.

It is fully supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes

More Examples

Example

Set a background color of a specific element:

Example

Return the background color of a specific element:

Example

Return the background color of a document:

Unlock Full Access 50% off

COLOR PICKER

colorpicker

Join our Bootcamp!

Report Error

If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:

Thank You For Helping Us!

Your message has been sent to W3Schools.

Top Tutorials
Top References
Top Examples
Get Certified

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Источник

Javascript Reference — HTML DOM Style backgroundColor Property

The backgroundColor property sets or gets the background color of an element.

Browser Support

backgroundColor Yes Yes Yes Yes Yes

Syntax

Return the backgroundColor property:

object.style.backgroundColor

Set the backgroundColor property:

object.style.backgroundColor=color|transparent|initial|inherit

Property Values

Value Description
color Specifies the background color.
transparent Default. The background color is transparent.
initial Set to default value.
inherit Inherit from parent element.

Technical Details

Default Value: transparent
Return Value: A string representing the background color
CSS Version CSS1

Example

The following code shows how to set a background color

 !DOCTYPE html> html> body> h1>Hello World! button type="button" onclick="myFunction()">test script> function myFunction() !--from w ww . jav a2s .c o m--> document.body.style.backgroundColor = "blue"; >   

The code above is rendered as follows:

Example 2

The following code shows how to set a background color for a element.

 !DOCTYPE html> html> head> style> #myDIV !-- w w w. j a va 2 s .c om--> width: 300px; height: 300px; background-color: red; color: white; >  body> button onclick="myFunction()">test div >"myDIV">Hello script> function myFunction() < document.getElementById("myDIV").style.backgroundColor = "blue"; >   

The code above is rendered as follows:

Example 3

The following code shows how to get the background color from a element.

 !DOCTYPE html> html> body> div >"myDiv" style="background-color:orange;">This is a div element. button type="button" onclick="myFunction()">test script> function myFunction() !-- ww w .ja v a2s .c o m--> console.log(document.getElementById("myDiv").style.backgroundColor); >   

The code above is rendered as follows:

Example 4

The following code shows how to get the background color for body tag.

 !DOCTYPE html> html> body style="background-color:yellow;"> button type="button" onclick="myFunction()">test script> function myFunction() !-- w w w. j a va 2s . co m--> console.log(document.body.style.backgroundColor); >   

The code above is rendered as follows:

java2s.com | © Demo Source and Support. All rights reserved.

Источник

Js element.style.background-color transparent

You can just reset properties by either setting them to an empty string:,Making statements based on opinion; back them up with references or personal experience., I am trying to find an online free to use algorithm based grammar checker, that can point out mistakes, reliably. Any suggestions? ,How can I remove the background-color and opacity property using Javascript only (no Jquery!).

You can just reset properties by either setting them to an empty string:

document.getElementById('darkOverlay').style.backgroundColor = ""; document.getElementById('darkOverlay').style.opacity = ""; 

Or setting them to the default values you like:

document.getElementById('darkOverlay').style.backgroundColor = "transparent"; document.getElementById('darkOverlay').style.opacity = "1"; 

Answer by Kaylee Pope

That assumes that shimmer is a valid reference to the body element of a document.,Remember Firefox has a default white background, but if that’s not it, how do you get the shimmer reference?,shimmer.style.backgroundColor = ‘rgba(255, 255, 255, 0.5)’;,BWT. without a background color, the dummy iframe will not appear

shimmer.style.backgroundColor = 'transparent'; 

Answer by Laila Holland

The CSS data type represents a color. A may also include an alpha-channel transparency value, indicating how the color should composite with its background. ,User’s preference for the document background color.,The color keywords all represent plain, solid colors, without transparency.,The RGB color model defines a given color in the sRGB color space according to its red, green, and blue components. An optional alpha component represents the color’s transparency.

 
The color of this text is blue. This block is surrounded by a blue border.

Answer by Andres Delarosa

Similar to the contextual text color classes, set the background of an element to any contextual class. Background utilities do not set color, so in some cases you’ll want to use .text-* color utilities.,Most background-color utilities are generated by our theme colors, reassigned from our generic color palette variables.,By adding a .bg-gradient class, a linear gradient is added as background image to the backgrounds. This gradient starts with a semi-transparent white which fades out to the bottom.,Convey meaning through background-color and add decoration with gradients.

.bg-primary
.bg-secondary
.bg-success
.bg-danger
.bg-warning
.bg-info
.bg-light
.bg-dark
.bg-body
.bg-white
.bg-transparent

Answer by Quincy Day

 // change background color for specific id .. function changebackground() < document.getElementById('id').style.backgroundColor = 'green' ; >// change background color for whole body.. function changebackground()

Answer by Averi Duncan

Set the opacity only to background color not on the text in CSS,How to set multiple background images using CSS?,How to style icon color, size, and shadow by using CSS ?,How to place two div side-by-side of the same height using CSS?

Answer by Archer Wilkins

*Note: The transparency discussed here is referring specifically to the iframe (the containing web element), not transparency in any videos you upload. Vimeo does not include alpha channel support at this time. ,By default, the background of the player iframe is transparent on Vimeo. All player elements (playbar, buttons, etc) are pinned to the video image, not the actual size of the iframe.,If your player displays differently than what you originally intended, you can disable the transparent background. To turn off the transparent background, add ?transparent=0 to the end of the player URL in your embed code. This parameter will force a black iframe background and pin the player elements to the iframe, instead of the video image. ,Important: the dimensions of the embedded player can also be influenced by the CSS styling established by your webpage. For videos embedded in a responsive design, make sure the height and width are both adjusted to maintain your video’s native aspect ratio.

Example embed code:

'

Источник

Оцените статью