CSS background-color ❮Previousaccent-coloralign-contentalign-itemsalign-selfanimationaspect-ratiobackdrop-filterbackgroundbackground-blend-modebackground-clipbackground-colorbackground-imagebackground-originbackground-positionbackground-position-xbackground-position-ybackground-repeatbackground-sizeblock-size...
CSS background - Shorthand propertyTo shorten the code, it is also possible to specify all the background properties in one single property. This is called a shorthand property.Instead of writing:body { background-color: #ffffff; background-image: url("img_tree.png"); background-repeat: ...
它有三个可选值content-box,padding- box,border-box(background-origin如果写在css中只有Opera浏览器可以识别,如果希望在火狐或者chrome或 Safari中使用,要使用它们浏览器的私有属性-moz-background-origin(Firefox),-webkit-background-origin(chrome,safari),并且对应的值是content,padding,border,省略了-box),即你...
CSS 版本 CSS1更多实例实例 设置特定 元素的背景色: document.getElementById("myDiv").style.backgroundColor = "lightblue"; 亲自试一试 » 实例 返回特定 元素的背景色: alert(document.getElementById("myDiv").style.backgroundColor); 亲自试一试 » 实例 返回文档的...
3 new properties were added in CSS3 (1999): background-clip background-origin background-size More Examples Example Change the background of a DIV element: document.getElementById("myDIV").style.background="url('smiley.gif') blue repeat-x center"; ...
CSS background-repeat: no-repeat Showing the background image only once is also specified by thebackground-repeatproperty: Example Show the background image only once: body{ background-image:url("img_tree.png"); background-repeat:no-repeat; ...
The background image can also be set for specific elements, like the element: Example p{ background-image:url("paper.gif"); } Try it Yourself » The CSS Background Image Property PropertyDescription background-imageSets the background image for an element Video...
CSS Reference:The background-image Property Syntax Return the backgroundImage property: object.style.backgroundImage Set the backgroundImage property: object.style.backgroundImage="url('URL')|none|initial|inherit" Property Values ValueDescription ...
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.