国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Web Front-end CSS Tutorial Common codes for adding background images to Xiaonei.com css code_Experience exchange

Common codes for adding background images to Xiaonei.com css code_Experience exchange

May 16, 2016 pm 12:04 PM
css

Serial number Chinese description mark syntax remarks
1 Background color {background-color: numerical value}
2 Background image {background-image: url(URL)|none}
3 Background repeat {background-repeat:inherit| no-repeat|repeat|repeat-x|repeat-y}
4 Background fixed {background-attachment:fixed|scroll}
5 Background positioning {background-position:value|top|bottom|left|right| center}
6 Back style {background: background color | background image | background repeat | background attachment | background position}

1. Background color: background-color

Syntax: {background-color:numeric}
Explanation: The parameter value is the same as the color attribute
Note: In HTML, a background must be added to an object There is only one way to change the color, and that is to make a table first, set the background color in the table, and then put the object into the cell. This is more troublesome. Not only does it require a lot of code, but it also takes some trouble with the size and positioning of the table. Now it's easy to do it directly with CSS, and the object range is very wide, it can be a piece of text, or just a word or a letter.
Example: Add a background color to some textAdd a background color to some text
Table back color: style="background-color:red"

2. Background image: background-image

Syntax: {background-image: url(URL)|none}
Explanation: URL is the storage path of the background image. If "none" is used instead of the background image storage path, nothing will be displayed.
Example: Add a background image to some text .imgbgstyle { background-image: url(logo.gif)}
3. Background repetition: background-repeat

Syntax: {background-repeat:inherit|no-repeat|repeat|repeat-x|repeat-y}
Function: Background image repetition controls background image tiling Or not, that is to say, combined with the control of background positioning, a background image can be displayed separately somewhere on the web page
Note: Parameter value range:
·inherit inheritance
·no-repeat not repeated Tile the background image
·repeat
·repeat-x makes the image tile only in the horizontal direction
·repeat-y makes the image tile only in the vertical direction
Note: If you do not specify a background For the image repeating attribute, the browser default is for the background image to be tiled in both horizontal and vertical directions.
4. Background fixed: background-attachment

Syntax: {background-attachment:fixed|scroll}
Description: Parameter value range
·fixed: When the web page is scrolled, the background image is relative to the browser window Generally speaking, fixed
·scroll: When the web page is scrolled, the background image scrolls together relative to the browser window
Note: The background image fixed controls whether the background image scrolls with the scrolling of the web page. If you do not set the background image fixed attribute, the browser's default background image will scroll with the scrolling of the web page. In order to prevent overly fancy background images from damaging the viewer's eyesight when scrolling, you can unbundle the background image and text content, which should be bundled with the browser window.
Example: CSS that prevents the background pattern from "scrolling" with the text
BODY { background: purple url(bg.jpg); background-repeat:repeat-y; background-attachment:fixed }
5. Background positioning: background-position

Syntax: {background-position:numeric|top|bottom|left|right|center}
Function: Background positioning is used to control the position of the background image displayed on the web page.
Description: Parameter value range
·Numeric parameter with length unit
·top: top alignment relative to the foreground object
·bottom: bottom alignment relative to the foreground object
·left: relative to the foreground object Left alignment
·right: Right alignment relative to the foreground object
·center: Center alignment relative to the foreground object
·Proportion relationship
The keywords are explained as follows:
top left = left top = 0% 0 %
top = top center = center top = 50% 0%
right top = top right = 100% 0%
left = left center = center left = 0% 50%
center = center center = 50% 50%
right = right center = center right = 100% 50%
bottom left = left bottom = 0% 100%
bottom = bottom center = center bottom = 50% 100% bottom right = right bottom = 100% 100%
Note: If the center in the parameter is used in front of another parameter, it means horizontal centering; if it is used after another parameter, it means vertical centering.
6. Background style: background

Syntax: {background:background color|background image|background repeat|background attachment|background position}
Function: The background attribute is a clearer background— Shorthand for relationship attributes. Here are some background declarations:
Example:
BODY { background: white url(http://www.htmlhelp.com/foo.gif) }
BLOCKQUOTE { background: #7fffd4 }
P { background: url(../backgrounds/pawn.png) #f0f8ff fixed }
TABLE { background: #0c0 url(leaves.jpg) no-repeat bottom right }
Note: When a value is not When specified, its initial value will be accepted. For example, in the first three rules above, the background position property would be set to 0% 0%. To avoid conflicts with the user's style sheet, the background and color should be specified together.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is 'render-blocking CSS'? What is 'render-blocking CSS'? Jun 24, 2025 am 12:42 AM

CSS blocks page rendering because browsers view inline and external CSS as key resources by default, especially with imported stylesheets, header large amounts of inline CSS, and unoptimized media query styles. 1. Extract critical CSS and embed it into HTML; 2. Delay loading non-critical CSS through JavaScript; 3. Use media attributes to optimize loading such as print styles; 4. Compress and merge CSS to reduce requests. It is recommended to use tools to extract key CSS, combine rel="preload" asynchronous loading, and use media delayed loading reasonably to avoid excessive splitting and complex script control.

External vs. Internal CSS: What's the Best Approach? External vs. Internal CSS: What's the Best Approach? Jun 20, 2025 am 12:45 AM

ThebestapproachforCSSdependsontheproject'sspecificneeds.Forlargerprojects,externalCSSisbetterduetomaintainabilityandreusability;forsmallerprojectsorsingle-pageapplications,internalCSSmightbemoresuitable.It'scrucialtobalanceprojectsize,performanceneed

What are the key differences between inline, block, inline-block, and flex display values? What are the key differences between inline, block, inline-block, and flex display values? Jun 20, 2025 am 01:01 AM

Choosing the correct display value in CSS is crucial because it controls the behavior of elements in the layout. 1.inline: Make elements flow like text, without occupying a single line, and cannot directly set width and height, suitable for elements in text, such as; 2.block: Make elements exclusively occupy one line and occupy all width, can set width and height and inner and outer margins, suitable for structured elements, such as; 3.inline-block: has both block characteristics and inline layout, can set size but still display in the same line, suitable for horizontal layouts that require consistent spacing; 4.flex: Modern layout mode, suitable for containers, easy to achieve alignment and distribution through justify-content, align-items and other attributes, yes

What is Autoprefixer and how does it work? What is Autoprefixer and how does it work? Jul 02, 2025 am 01:15 AM

Autoprefixer is a tool that automatically adds vendor prefixes to CSS attributes based on the target browser scope. 1. It solves the problem of manually maintaining prefixes with errors; 2. Work through the PostCSS plug-in form, parse CSS, analyze attributes that need to be prefixed, and generate code according to configuration; 3. The usage steps include installing plug-ins, setting browserslist, and enabling them in the build process; 4. Notes include not manually adding prefixes, keeping configuration updates, prefixes not all attributes, and it is recommended to use them with the preprocessor.

How can you animate an SVG with CSS? How can you animate an SVG with CSS? Jun 30, 2025 am 02:06 AM

AnimatingSVGwithCSSispossibleusingkeyframesforbasicanimationsandtransitionsforinteractiveeffects.1.Use@keyframestodefineanimationstagesforpropertieslikescale,opacity,andcolor.2.ApplytheanimationtoSVGelementssuchas,,orviaCSSclasses.3.Forhoverorstate-b

What is the conic-gradient() function? What is the conic-gradient() function? Jul 01, 2025 am 01:16 AM

Theconic-gradient()functioninCSScreatescirculargradientsthatrotatecolorstopsaroundacentralpoint.1.Itisidealforpiecharts,progressindicators,colorwheels,anddecorativebackgrounds.2.Itworksbydefiningcolorstopsatspecificangles,optionallystartingfromadefin

What is the scope of a CSS Custom Property? What is the scope of a CSS Custom Property? Jun 25, 2025 am 12:16 AM

The scope of CSS custom properties depends on the context of their declaration, global variables are usually defined in :root, while local variables are defined within a specific selector for componentization and isolation of styles. For example, variables defined in the .card class are only available for elements that match the class and their children. Best practices include: 1. Use: root to define global variables such as topic color; 2. Define local variables inside the component to implement encapsulation; 3. Avoid repeatedly declaring the same variable; 4. Pay attention to the coverage problems that may be caused by selector specificity. Additionally, CSS variables are case sensitive and should be defined before use to avoid errors. If the variable is undefined or the reference fails, the fallback value or default value initial will be used. Debug can be done through the browser developer

CSS tutorial focusing on mobile-first design CSS tutorial focusing on mobile-first design Jul 02, 2025 am 12:52 AM

Mobile-firstCSSdesignrequiressettingtheviewportmetatag,usingrelativeunits,stylingfromsmallscreensup,optimizingtypographyandtouchtargets.First,addtocontrolscaling.Second,use%,em,orreminsteadofpixelsforflexiblelayouts.Third,writebasestylesformobile,the

See all articles