In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what are the advanced skills in CSS", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn this article "what are the advanced skills in CSS?"
Use: not () to apply / unapply borders on menus
Add a border to each menu item first
/ * add border * / .nav li {border-right: 1px solid # 666;}
…… And then remove the last element.
/ / * remove border * /
.nav li:last-child {border-right: none;}
…… You can directly use the: not () pseudo class to apply the element:
.nav li:not (: last-child) {border-right: 1px solid # 666;}
This makes the code clean, easy to read, and easy to understand.
Of course, if your new element has a sibling element, you can also use the general sibling selector (~):
.. nav li:first-child ~ li {
Border-left: 1px solid # 666;} add line height to body
You don't need to add line-height to each separately
Wait. Simply add to body:
Body {line-height: 1;}
This makes it easy for text elements to inherit from body.
Everything is vertically centered.
It's too easy to center all elements vertically:
Html, body {height: 100%; margin: 0;} body {- webkit-align-items: center;-ms-flex-align: center; align-items: center; display:-webkit-flex; display: flex;}
Look, isn't it easy.
Note: beware of flexbox in IE11.
Comma separated list
Make the HTML list items look like a real, comma-separated list:
Ul > li:not (: last-child): after {content: ",";}
Use the: not () pseudo class for the last list item.
Select a project using a negative nth-child
Use negative nth-child in CSS to select items 1 to n.
Li {display: none;} / * select items 1 through 3 and display them * / li:nth-child (- nasty 3) {display: block;}
It's that easy.
Use SVG with icons
There is no reason why we should not use SVG for icons:
.logo {background: url ("logo.svg");}
SVG is scalable for all resolution types and supports all browsers to return to IE9. This avoids .png, .jpg, or .gif files.
Optimize display of text
Sometimes fonts don't work best on all devices, so you can ask the device browser to help you:
Html {- moz-osx-font-smoothing: grayscale;-webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;}
Note: please use optimizeLegibility responsibly. In addition, IE / Edge does not have text-rendering support.
Use max-height for pure CSS sliders
Use max-height and overflow hiding to implement the CSS-only slider:
.slider ul {max-height: 0; overlow: hidden;} .slider:hover ul {max-height: 1000px; transition: .3s ease;} inherits box-sizing
Let box-sizing inherit html:
Html {box-sizing: border-box;} *, *: before, *: after {box-sizing: inherit;}
This makes it easier to change the box-sizing in other components of plug-ins or other behaviors of leverage.
Table cells are equal in width
Tables are troublesome to work with, so be sure to use table-layout: fixed as much as possible to keep cells equal in width:
.outline {table-layout: fixed;} use Flexbox to get rid of various hack of outer margins
When you need to use column delimiters, you can get rid of the hack of nth-,first-, and last-child through the space-between property of flexbox:
.list {display: flex; justify-content: space-between;} .list .person {flex-basis: 23%;}
The list delimiter now appears at evenly spaced locations.
Use the property selector for empty links
Displays a link when the element has no text value but the href attribute has a link:
A [href ^ = "http"]: empty::before {content: attr (href);}
It's quite convenient.
Support
These advanced techniques work effectively in current versions of Chrome, Firefox, Safari, Edge, and IE11.
The above is all the content of the article "what are the Advanced skills in CSS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.