Home Web Front-end HTML Tutorial css relief effect_html/css_WEB-ITnose

css relief effect_html/css_WEB-ITnose

Jun 24, 2016 am 11:38 AM

Relief effect

I saw an effect when I looked at Baidu map today

I felt that this effect would be great when used on a web page, so I learned about it

The embossing effect requires knowledge of the telescopic box (flex)

flex is available in chrome If it is fully supported, you need to add the -webkit- prefix. Some other browsers support it and some do not. Check the css manual yourself. Today I mainly want to talk about how to create the relief effect

Attached is the code first:

1  <div class="title">2         <div class="word">生活服务</div>3         <div class="relief">4             <div class="border"></div>5         </div>6     </div>
Copy after login

 1 body,div{ 2      padding: 0; 3      margin: 0; 4  } 5 .title{ 6     font-size: 15px; 7     font-family: "Microsoft Yahei", "Trebuchet MS", Arial, Helvetica, sans-serif; 8     display: -webkit-flex; 9     -webkit-align-items: center;10     margin-top: 50px;11     margin-left: 20px;12     margin-right: 20px;13 }14 15 .word{16     -webkit-flex: 0 0 auto;17     padding-right: 10px;18 }19 .relief{20     -webkit-flex: 1;21 }22 .border{23     height: 0;24     width: 100%;25     border-top: 1px solid #808080;26     border-bottom: 1px solid #fff;27 }
Copy after login

Attached is the effect I made:

A very practical effect

flex style analysis:

display:-webkit-flex Provides a container for the flex box

-webkit-align- items:

flex-start: The border of the starting position of the cross axis (vertical axis) of the flex box element is close to the starting border of the cross axis of the row. flex-end: The boundary of the starting position of the cross axis (vertical axis) of the flex box element is close to the end boundary of the cross axis of the row. center: The flexbox element is centered on the cross axis (vertical axis) of the row. (If the size of the row is smaller than the size of the flexbox element, it will overflow the same length in both directions).

-webkit-flex:Composite attribute. Sets or retrieves how space is allocated for child elements of the flexbox model object.

none: The calculated value of the none keyword is: 0 0 auto [flex-grow]: Defines the expansion ratio of the flex box element. (Define space allocation rights) [ flex-shrink ]: Define the shrinkage ratio of flex box elements. (If it overflows, the extra space will be digested in proportion) [flex-basis]: Define the default basis value of the flex box element. (Define the width value of the element. If not specified, it depends on the width value of the element itself)

Finally, set the border attribute in the border to complete the production of the relief effect

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

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.

Undress AI Tool

Undress AI Tool

Undress images for free

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)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

See all articles