Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize css highly adaptive

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article analyzes "how to achieve a high degree of css adaptation". The content is detailed and easy to understand. Friends who are interested in "how to achieve a high degree of css adaptation" can follow the editor's idea to read it slowly and deeply. I hope it will be helpful to everyone after reading. Let's follow the editor to learn more about "how to achieve a high degree of css adaptation".

First of all, when we first design some web pages, we always give them a height height value to make it fit the content size.

Let's look at a specific example code.

Title .con {height:100px; width:400px; background-color:#9fcdff; color:black;}

The method of giving it a height height value occurs when you add content:

2345 Screenshot 20180910111333.png

This is the so-called high degree of inadaptability, that is, css is highly unable to achieve content-based adaptation, so how do we achieve css highly content-based adaptation?

It's actually very simple, here we just need to remove the height attribute and give it a value of padding-bottom. In that case, css height will be adaptive according to the content.

The padding-bottom attribute sets the bottom inner margin (bottom space) of the element.

Let's take a look at the specific highly adaptive implementation code:

Title .con {padding-bottom:1cm; width:400px; background-color:red; color:black;}

Three ways of introducing css 1. Inline style, the most straightforward and simplest, uses style= "" directly for HTML tags. two。 The embedded style is to write the CSS code in between and use the

To make a statement. 3. External style, in which the link style is the most frequently used and the most practical style, only need to add

Just do it. The second is to import styles, import styles and link styles are similar, using @ import style to import CSS stylesheets, not recommended. On how to achieve a high degree of self-adaptation of css to share here, I hope the above content can make you improve. If you want to learn more knowledge, please pay more attention to the editor's updates. Thank you for following the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report