


Detailed explanation of the setting of background-image attribute in HTML_HTML/Xhtml_Web page production
For pictures, the first thing we think of is the background picture. Because many of our decorations are implemented using background pictures. In this case, let’s start with controlling the background image with CSS.
Definition and usage
The background-image attribute sets the background image for the element.
Theelement's background takes up the entire size of the element, including padding and borders, but not margins.
By default, the background image is placed in the upper left corner of the element and repeats horizontally and vertically.
1. CSS control background image:
For a web page, when we start designing, we may not think too much about what the background image is, because most of them just design the background color. I think the reason is very simple, because it is related to the foreground. Just like music, it will have a certain impact on the speed of opening a web page. However, for a general personal website or personal blog, it is of course indispensable for showing one's own personality. Of course, nothing is too perfect. There are good and bad. That is, when the image is not available but When CSS is enabled, replacement content will not be displayed, so it is not recommended to use CSS background images for navigation button text or similar situations.
There are many CSS properties for controlling background images. As long as they are related to images, most of them will be used.
(1). Import of background images:
Of course the most familiar ones are background and background-image.
The code for designing background images for web pages is:
body {background:url("d:images
orbody {background-image:url("d:images
(2) How to display the background image:
Of course, you cannot express the effect you want by just using the above code. Because if the picture is small, it will be tiled. If it is large, scroll bars will appear in order to display it, which is not good. Therefore, we have to perform more display control, that is, we need to use background-repeat,
It is the value:
no-repeat: The background image is not tiled
repeat-x: The background image is only tiled horizontallyrepeat-y: The background image is only tiled vertically
As for the code, I think anyone who knows a little CSS will know it, as follows
:
(3), background image size control:
I think many people will naturally use the following code:
Copy code
Haha, the idea is good, but does the browser you are using support it? I think IE or FF will definitely treat it as if they didn’t see it. Maybe you will ask, when I designed the forum style, was it achievable? I think if it is just the above code, it cannot control the picture, because it only controls the size of the BODY. Of course, there is no control here. If it is other ID tags, I think the range size of the tag can be controlled, haha, of course it is not the size of the image.
To be honest, this problem not only bothers you, but also bothers me. Because it is just the value of a property, not a real object. If you think of using CSS control, remember to tell me.
Supplement: W3C published an article called "CSS Backgrounds and Borders Module Level 3" on September 10, which adds several attributes to the CSS background that we have never seen before:
background-clip :
background-origin :
background-size :Background size.
background-break :
Although these attributes are available, there are currently no browsers that support them. It’s so distressing.
(4), background image position control:
My department imported the background image, but its location is really unacceptable. Because it is aligned to the upper left by default. But we don’t want to place it like this, so what should we do? Don't worry, the exciting moment is coming soon. Now, let's get to know background-position, background-position-x and background-position-y.
a. Basic grammar:
background-position : length || length
background-position : position || position
background-position-x : length | left | center | right
background-position-y : length | top | center | bottom
b. Grammar value:
length: Percentage | A length value consisting of a floating point number and a unit identifier.
position : top | center | bottom | left | center | right
c. Example:
body { background-image: url("d:images
I will only write the following three examples for the values of length | top | center | bottom.
Having said so many examples, I think you have a certain understanding of positioning.
(5), Transparency setting of background image:
Sometimes, we always want to set the picture to be transparent.
(6). Setting of multiple background images:
Regarding the setting of multiple background images, I saw it in "Beyond CSS: The Essence of WEB Design Art". However, it makes me very sad because the current browsers that support multiple background images in one label are too small, and the only one I know of is Apple Safari. You may ask, how is this possible. After you read this example, I think you will be surprised, "Oh my god, before CSS3, you could only use one image for each element." If you want to study it, install a Safari browser quickly. To me, I believe this is the trend. In a word, whoever has the stronger ability to interpret CSS will become the trend of development. Whoever has perfect WEB standards will be the browser star of tomorrow.
The code is as follows:
Copy the code

HTMLtagsdefinethestructureofawebpage,whileattributesaddfunctionalityanddetails.1)Tagslike,,andoutlinethecontent'splacement.2)Attributessuchassrc,class,andstyleenhancetagsbyspecifyingimagesources,styling,andmore,improvingfunctionalityandappearance.

The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools
