1. Background
1. Use the background-color attribute for the background color, for example: body{background-color:red}
2. Use the background-image attribute to use an image as the background, such as body{background-image:ul1(23.jpg)
3. Use the background-repeat attribute to repeatedly tile the background from the image, repeat- x or repeat-y means horizontal or vertical tiling respectively,
no-repeat means allowing tiling from any direction
For example: body
{background-image:url(23 .jpg)
background-repeat:repeat-x:) }
4. Use the background-position attribute to position the background, [position: top, bottom, left, right, center, you can also use
Percent (50% 50%), length value (50px 50px)]
For example: body
{background-image:url (23.jpg)
background-position:center}
5. Use background-attachment to set the image association attributes. For example, the background of the picture below will not scroll with the scrolling of the text
body{background-image:url(23.jpg);
background-repeat:no-repeat;
background-attachment:fixed;}
##2. Text
1. Use the text-indent attribute to indent text. The most common one is the indentation of the first line of a paragraph. The indent value can be a negative number. For example: p{text- indent:-5em}, but setting a negative number can easily exceed the left boundary of the browser window, so special attention should be paid; The indent value unit can be percentage %, the length unit px, and the measurement unit em; The text-indent attribute can be inherited, for example:p#outer {width:500px;}
p#inter {text-indent:10%}
p{width:200px;}
some text.some text.some text.
this is a pragramph
2. Use text-align attributes (left, right, center, justice) for horizontal alignment 3. Word-spacing can change the word ( The standard spacing between words), the default value normal is the same as the setting value 0, word-spacing accepts positive length values and negative length values4, letter-spacing Change the spacing between characters and letters. Others are the same as word-spacing. The default value normal is the same as setting the value to 0. It accepts positive and negative length values. 5, text -transform handles the case of text (none, uppercase, lowercase, capitalize with the first letter in uppercase 6, text-decoration handles text decoration (none, underline, overline, line-through) , blink flashing 7, processing white-space white-space value pre-line, white space character: merge, newline character: reserved, automatic line wrapping: allowed;
value normal, blank Character: merge, newline character: ignore, automatic line wrapping: allowed;
value nowrap, whitespace character: merge, newline character: reserved, automatic newline character: not allowed value pre-wrap, whitespace character: reserved, newline character : Reserved, automatic line wrapping: allow
8. The direction attribute affects the writing direction of text in block-level elements, the direction of layout in lists, the direction of content horizontally filling its text box, and the direction of the last line in justified elements. Position (there are two values, ltr and rtk, where ltr is the default value and is the direction from left to right)
The above is the detailed content of Detailed introduction to CSS style background and text. For more information, please follow other related articles on the PHP Chinese website!
Weekly Platform News: Web Apps in Galaxy Store, Tappable Stories, CSS SubgridApr 14, 2025 am 11:20 AMIn this week's roundup: Firefox gains locksmith-like powers, Samsung's Galaxy Store starts supporting Progressive Web Apps, CSS Subgrid is shipping in Firefox
Weekly Platform News: Internet Explorer Mode, Speed Report in Search Console, Restricting Notification PromptsApr 14, 2025 am 11:15 AMIn this week's roundup: Internet Explorer finds its way into Edge, Google Search Console touts a new speed report, and Firefox gives Facebook's notification
The Power (and Fun) of Scope with CSS Custom PropertiesApr 14, 2025 am 11:11 AMYou’re probably already at least a little familiar with CSS variables. If not, here’s a two-second overview: they are really called custom properties, you set
We Are ProgrammersApr 14, 2025 am 11:04 AMBuilding websites is programming. Writing HTML and CSS is programming. I am a programmer, and if you're here, reading CSS-Tricks, chances are you're a
How Do You Remove Unused CSS From a Site?Apr 14, 2025 am 10:59 AMHere's what I'd like you to know upfront: this is a hard problem. If you've landed here because you're hoping to be pointed at a tool you can run that tells
An Introduction to the Picture-in-Picture Web APIApr 14, 2025 am 10:57 AMPicture-in-Picture made its first appearance on the web in the Safari browser with the release of macOS Sierra in 2016. It made it possible for a user to pop
Ways to Organize and Prepare Images for a Blur-Up Effect Using GatsbyApr 14, 2025 am 10:56 AMGatsby does a great job processing and handling images. For example, it helps you save time with image optimization because you don’t have to manually
Oh Hey, Padding Percentage is Based on the Parent Element's WidthApr 14, 2025 am 10:55 AMI learned something about percentage-based (%) padding today that I had totally wrong in my head! I always thought that percentage padding was based on the


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version
Visual web development tools

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






