CSS background-image property - W3Schools
文章推薦指數: 80 %
More "Try it Yourself" examples below. Definition and Usage. The background-image property sets one or more background images for an element. Tutorials References Exercises VideosNEW Menu Login PaidCourses WebsiteNEW HTML CSS JAVASCRIPT SQL PYTHON PHP BOOTSTRAP HOWTO W3.CSS JAVA JQUERY C++ C# R React Kotlin × Tutorials HTMLandCSS LearnHTML LearnCSS LearnRWD LearnBootstrap LearnW3.CSS LearnColors LearnIcons LearnGraphics LearnSVG LearnCanvas LearnHowTo LearnSass DataAnalytics LearnAI LearnMachineLearning LearnDataScience LearnNumPy LearnPandas LearnSciPy LearnMatplotlib LearnStatistics LearnExcel XMLTutorials LearnXML LearnXMLAJAX LearnXMLDOM LearnXMLDTD LearnXMLSchema LearnXSLT LearnXPath LearnXQuery JavaScript LearnJavaScript LearnjQuery LearnReact LearnAngularJS LearnJSON LearnAJAX LearnAppML LearnW3.JS Programming LearnPython LearnJava LearnC++ LearnC# LearnR LearnKotlin LearnGo ServerSide LearnSQL LearnMySQL LearnPHP LearnASP LearnNode.js LearnRaspberryPi LearnGit WebBuilding CreateaWebsiteNEW WebTemplates WebStatistics WebCertificates WebDevelopment CodeEditor TestYourTypingSpeed PlayaCodeGame CyberSecurity Accessibility DataAnalytics LearnAI LearnMachineLearning LearnDataScience LearnNumPy LearnPandas LearnSciPy LearnMatplotlib LearnStatistics LearnExcel LearnGoogleSheets XMLTutorials LearnXML LearnXMLAJAX LearnXMLDOM LearnXMLDTD LearnXMLSchema LearnXSLT LearnXPath LearnXQuery × References HTML HTMLTagReference HTMLBrowserSupport HTMLEventReference HTMLColorReference HTMLAttributeReference HTMLCanvasReference HTMLSVGReference GoogleMapsReference CSS CSSReference CSSBrowserSupport CSSSelectorReference Bootstrap3Reference Bootstrap4Reference W3.CSSReference IconReference SassReference JavaScript JavaScriptReference HTMLDOMReference jQueryReference AngularJSReference AppMLReference W3.JSReference Programming PythonReference JavaReference ServerSide SQLReference MySQLReference PHPReference ASPReference XML XMLDOMReference XMLHttpReference XSLTReference XMLSchemaReference CharacterSets HTMLCharacterSets HTMLASCII HTMLANSI HTMLWindows-1252 HTMLISO-8859-1 HTMLSymbols HTMLUTF-8 × ExercisesandQuizzes Exercises HTMLExercises CSSExercises JavaScriptExercises SQLExercises MySQLExercises PHPExercises PythonExercises NumPyExercises PandasExercises SciPyExercises jQueryExercises JavaExercises C++Exercises C#Exercises RExercises KotlinExercises GoExercises BootstrapExercises Bootstrap4Exercises Bootstrap5Exercises GitExercises Quizzes HTMLQuiz CSSQuiz JavaScriptQuiz SQLQuiz MySQLQuiz PHPQuiz PythonQuiz NumPyQuiz PandasQuiz SciPyQuiz jQueryQuiz JavaQuiz C++Quiz C#Quiz RQuiz XMLQuiz CyberSecurityQuiz BootstrapQuiz Bootstrap4Quiz Bootstrap5Quiz AccessibilityQuiz Courses HTMLCourse CSSCourse JavaScriptCourse FrontEndCourse SQLCourse PHPCourse PythonCourse NumPyCourse PandasCourse DataAnalyticsCourse jQueryCourse JavaCourse C++Course C#Course RCourse XMLCourse CyberSecurityCourse AccessibilityCourse Certificates HTMLCertificate CSSCertificate JavaScriptCertificate FrontEndCertificate SQLCertificate PHPCertificate PythonCertificate DataScienceCertificate Bootstrap3Certificate Bootstrap4Certificate jQueryCertificate JavaCertificate C++Certificate ReactCertificate XMLCertificate × Tutorials References Exercises PaidCourses Spaces Videos Shop CSSReference CSSReference CSSBrowserSupport CSSSelectors CSSFunctions CSSReferenceAural CSSWebSafeFonts CSSFallbackFonts CSSAnimatable CSSUnits CSSPX-EMConverter CSSColors CSSColorValues CSSDefaultValues CSSEntities CSSProperties align-content align-items align-self all animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side caret-color @charset clear clip clip-path color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font @font-face font-family font-feature-settings font-kerning font-size font-size-adjust font-stretch font-style font-variant font-variant-caps font-weight gap grid grid-area grid-auto-columns grid-auto-flow grid-auto-rows grid-column grid-column-end grid-column-gap grid-column-start grid-gap grid-row grid-row-end grid-row-gap grid-row-start grid-template grid-template-areas grid-template-columns grid-template-rows hanging-punctuation height hyphens image-rendering @import isolation justify-content @keyframes left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top max-height max-width @media min-height min-width mix-blend-mode object-fit object-position opacity order orphans outline outline-color outline-offset outline-style outline-width overflow overflow-wrap overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page-break-after page-break-before page-break-inside perspective perspective-origin pointer-events position quotes resize right row-gap scroll-behavior tab-size table-layout text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-style text-indent text-justify text-overflow text-shadow text-transform top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi user-select vertical-align visibility white-space widows width word-break word-spacing word-wrap writing-mode z-index CSSbackground-imageProperty ❮Previous CompleteCSSReference Next❯ Example Setabackground-imageforthe
element: body{ background-image:url("paper.gif"); background-color:#cccccc; } TryitYourself» Example Settwobackgroundimagesfortheelement: body{ background-image:url("img_tree.gif"),url("paper.gif"); background-color:#cccccc;} TryitYourself» More"TryitYourself"examplesbelow. DefinitionandUsage Thebackground-imagepropertysetsoneormorebackgroundimagesforanelement. Bydefault,abackground-imageisplacedatthetop-leftcornerofan element,andrepeatedbothverticallyandhorizontally. Tip:Thebackgroundofanelementisthetotalsizeoftheelement,including paddingandborder(butnotthemargin). Tip:Alwayssetabackground-colortobeusediftheimageisunavailable. Defaultvalue: none Inherited: no Animatable: no.Readaboutanimatable Version: CSS1+newvaluesinCSS3 JavaScriptsyntax: object.style.backgroundImage="url(img_tree.gif)" Tryit BrowserSupport Thenumbersinthetablespecifythefirstbrowserversionthatfullysupportstheproperty. Property background-image 1.0 4.0 1.0 1.0 3.5 Note:IE8andearlierdonotsupportmultiplebackgroundimages. CSSSyntax background-image:url|none|initial|inherit; PropertyValues Value Description url('URL') TheURLtotheimage.Tospecifymorethanoneimage,separatetheURLswithacomma none Nobackgroundimagewillbedisplayed.Thisisdefault conic-gradient() Setsaconicgradientasthebackgroundimage.Defineatleasttwo colors linear-gradient() Setsalineargradientasthebackgroundimage.Defineatleasttwo colors(toptobottom) radial-gradient() Setsaradialgradientasthebackgroundimage.Defineatleasttwo colors(centertoedges) repeating-conic-gradient() Repeatsaconicgradient repeating-linear-gradient() Repeatsalineargradient repeating-radial-gradient() Repeatsaradialgradient initial Setsthispropertytoitsdefaultvalue.Readaboutinitial inherit Inheritsthispropertyfromitsparentelement.Readaboutinherit MoreExamples Example Setstwobackgroundimagesfortheelement.Letthefirst imageappearonlyonce(withno-repeat),andletthesecondimageberepeated: body{ background-image:url("img_tree.gif"),url("paper.gif"); background-repeat:no-repeat,repeat; background-color:#cccccc;} TryitYourself» Example Usedifferentbackgroundpropertiestocreatea"hero"image: .hero-image{ background-image:url("photographer.jpg");/*The imageused*/ background-color:#cccccc;/*Usediftheimageis unavailable*/ height:500px;/*Youmustsetaspecifiedheight*/ background-position:center;/*Centertheimage*/ background-repeat:no-repeat;/*Donotrepeattheimage*/ background-size:cover;/*Resizethebackgroundimagetocovertheentirecontainer*/} TryitYourself» Example Setsalinear-gradient(twocolors)asabackgroundimagefora延伸文章資訊
- 1Best 100+ Free Background Images [HD] | Download your next
Download the perfect background images. Find over 100+ of the best free background images. Free f...
- 2121624 free background images and pictures in HD - Pixabay
Find your perfect background for your phone, desktop, website or more! ✓ Free download ✓ HD & 4K ...
- 3CSS background-image property - W3Schools
More "Try it Yourself" examples below. Definition and Usage. The background-image property sets o...
- 4100000+ Best Background Photos - Pexels
Download and use 100000+ background stock photos for free. ✓ Thousands of new images every day ✓ ...
- 5190 Best Background ideas - Pinterest
Jul 18, 2019 - Explore R.N CreatioN's board "Best Background", followed by 4450 people on Pintere...