Making source: for CSS stars ✨ say | o | give a ❤ ️ attention, ❤ ️ thumb up, ❤ ️ encourages the author
Hello everyone, I’m Nezha. Nice to meet you ~~
Nezha’s life creed: If you like what you learn, there will be strong motivation to support it.
Learn programming every day, so that you can get a step away from your dream. Thank you for not living up to every programmer who loves programming. No matter how strange the knowledge point is, work with me to calm down the wandering heart and keep going. Welcome to follow me vx:xiaoda0423, welcome to like, favorites and comments
preface
If this article is helpful to you, give ❤️ a follow, ❤️ like, ❤️ encourage the author, accept the challenge? Article public account launch, concern programmer Doraemon first time access to the latest article
❤ ️ cartridge ❤ ️ ~
Use CSS
Example:
<! DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style></style> </head> <body> <div id="header"> < h1 > navigation < / h1 > < ul > < li > < a href = "#" > directory 1 < / a > < / li > < li > < a href = "#" > 2 directory < / a > < / li > < li > < a href = "#" > directory 3 < / a > < / li > < li > < a Directory href = "#" > 4 < / a > < / li > < / ul > < / div > < / body > < / HTML >Copy the code
Effect:
- Remove the list symbol from the navigation bar
<! DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style> #header ul { list-style: none; padding: 0; margin: 0; } < / style > < / head > < body > < div id = "header" > < h1 > navigation bar < / h1 > < ul > < li > < a href = "#" > directory 1 < / a > < / li > < li > < a href = "#" > 2 directory < / a > < / li > < li > < a href = "#" > directory 3 < / a > < / li > < li > < a href = "#" > directory 4 < / a > < / li > < / ul > < / div > < / body > < / HTML >Copy the code
Effect:
Change 1:
<! DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style> #header ul { list-style: none; padding: 0; margin: 0; } #header li { display: inline; border: solid; border-width: 1px 1px 0 1px; Margin: 0 0.5em 0 0; } < / style > < / head > < body > < div id = "header" > < h1 > navigation bar < / h1 > < ul > < li > < a href = "#" > directory 1 < / a > < / li > < li > < a href = "#" > 2 directory < / a > < / li > < li > < a href = "#" > directory 3 < / a > < / li > < li > < a href = "#" > directory 4 < / a > < / li > < / ul > < / div > < / body > < / HTML >Copy the code
Effect:
Change 2:
<! DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style> #header ul { list-style: none; padding: 0; margin: 0; } #header li { display: inline; border: solid; border-width: 1px 1px 0 1px; Margin: 0 0.5em 0 0; } #header li a { padding: 0 1em; } < / style > < / head > < body > < div id = "header" > < h1 > navigation bar < / h1 > < ul > < li > < a href = "#" > directory 1 < / a > < / li > < li > < a href = "#" > 2 directory < / a > < / li > < li > < a href = "#" > directory 3 < / a > < / li > < li > < a href = "#" > directory 4 < / a > < / li > < / ul > < / div > < / body > < / HTML >Copy the code
Effect:
Creating a selector
- HTML selector
- Flag selector
- Class selectors
// Derive selector h1 h2 {} // flag selector #text {} // class selector. }Copy the code
Pseudo classes:
:active
Adds the style to the activated element:focus
Adds the style to the selected element:hover
Adds a style to a page object when the cursor hovers over it:link
To add styles to links that have not been accessed:visited
To add styles to the links that have been visited:first-child
Adds a special style to the first child of the page object:lang
Allows the designer to define the language to be used in a given page
The text font size
The font size property changes the size of a font.
Common:
px
;em
;%
.
1. The unit of pixels is PX. The font size is defined in absolute units, such as 12px.
2. Font size em, a font size is 1em, the default font size in any browser is 1em.
3. Percentage %, the size defined as a percentage of the current text.
Modifies the properties of the page text and page background
background
To set the background property in a declarationbackground-color
, sets the background color of the page objectbackground-image
, reference the image and set it as the backgroundbackground-repeat
To set the way the background image is repeatedbackground-position
To set the location of the background imagebackground-attachment
To set whether the background image is fixed or scrolls with the rest of the pagecolor
, sets the text colorline-height
, set the row heightwhite-space
Sets the way paragraphs in the element are typesetword-spacing
, set the word spacingfont-family
To set the text fontfont-size
, set the font sizefont-style
, set the font stylefont-weight
, set the font sizedirection
To set the text directionletter-spacing
To set the character spacingtext-align
To align the text on the pagetext-decoration
Add a underline to the texttext-transform
Controls the letters in the element
Browser support
Webkit-engine browsers like Safari,Chrom’s private property prefix is -webkit-, Gecko’s private property prefix is -moz- for Firefox, Opera’s private property prefix is -O -, Internet Explorer, The prefix for private attributes limited to IE 8+ is -ms-.
Range of new features
The introduction of wildcards in attribute selectors, flexible pseudo-class selectors such as nth-child(), etc.
Property selector
E[attr]
, choose to haveattr
Properties of theE
Elements.E[attr="val"]
, choose to haveattr
Property and the property value is equal tovalue
theE
Elements.E[att~="val"]
, choose to haveattr
Property and the property value is a whitespace separated list of words, one of which is equal toval
theE
The elementE[attr|="value"]
, choose to haveattr
Property, and the property value is a hyphenated list of words, indicating thatval
The start of theE
The elementE[attr^="val"]
, choose to haveattr
Property and the property value isval
Of the string at the beginningE
The elementE[attr$="val"]
, choose to haveattr
Property and the property value isval
The end of the stringE
The elementE[attr*="val"]
, choose to haveattr
Property and the property value is containedval
Of the string ofE
The element
^ Indicates the start of the match. $indicates the end of the match. * indicates any characterCopy the code
CSS structure pseudo-class selector
E:root
, select matchE
The root element of the documentE:not(s)
, select match all unmatched simple selectorss
theE
The elementE:empty
Matches elements that do not have any child elementsE
E:target
Matches the current link address pointing toE
The elementE:first-child
Matches the first child of the parent elementE
E:last-child
Matches the last child of the parent elementE
E:nth-child(n)
Matches the NTH child of the parent elementE
E:nth-last-child(n)
Matches the penultimate NTH child of the parent elementE
E:only-child
Matches only one child of the parent elementE
E:first-of-type
Matches the first sibling element of the typeE
E:last-of-type
Matches the last sibling element of the same typeE
E:only-of-type
Matches the only sibling element of the same typeE
E:nth-of-type(n)
Matches the NTH sibling element of the same typeE
E:nth-last-of-type(n)
Matches the penultimate sibling element of the same typeE
CSS structure pseudo-class selector
E:link
, set up hyperlinksa
The style before it is accessedE:visited
, set up hyperlinksa
Outdated style in which the link address has been accessedE:hover
Sets the style of the element when the cursor is hoveringE:active
Sets the style of the element when activated by the userE:foucs
Sets the style of the element when it becomes the focus of inputE:checked
Matches all elements in the selected state of the user interfaceE
E:enabled
Matches all elements in the available state of the user interfaceE
E:disabled
Matches all elements whose user interface is disabledE
Pseudoelement selector
E:first-letter/E::first-letter
, sets the style of the first character in the objectE:first-line/E::first-line
To set the style of the first line in the objectE:before/E::before
Set the content that occurs before the object to be used with the Content propertyE:after/E::after
, sets what happens after the object, used with the Content propertyE::selection
, sets the selected color
The text
Text shadow
text-shadow: length || lenth || opacity || color
// text-shadow: 5px 5px 3px #333
text-shadow: -1px 0 #333, 0 -1px #333, 1px 0 #333, 0 1px #333;
Copy the code
Text overflow processing:
Text - overflow: clip | ellipsis | overflow text ellipsis - word / / omit tag overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 200px; Set the width, hide the overflow, force the text to be displayed on a single line, and set the overflow to be displayed as an ellipsis flagCopy the code
Boundary line wrap property: word-wrap, used to set or index whether the current line breaks when it exceeds the boundary of the specified container
word-wrap: normal | break-word
Copy the code
normal
Represents the default continuous text wrap, allowing content to go beyond boundaries,break-word
Indicates that content will be wrapped inside the boundary
word-break: normal | break-all | keep-all
Copy the code
Word-break sets or retrieves the in-word wrapping behavior of text within an object
@font-face Syntax rules
Use it to load font files on the server side
@font-face: {attribute: value; Font-size: medium; variant: medium; font-size: medium; font-size: medium; Font-stretch: sets whether the text is stretched horizontally. Fontsize: sets the size of the text font. SRC: sets the relative or absolute path of the customized fontCopy the code
Opactity properties
Opacity: < alpha > | inherit / / opacity, inherited the opacity of the parent elementCopy the code
Background
background: [background-image] | [background-origin] | [background-clip] | [background-repeact] | [background-size] | [background-position]
Copy the code
background-origin: border-box | padding-box | content-box
Copy the code
background-clip: border-box | padding-box | content-box
Copy the code
Background - size: [< length > | < percentage > | auto] {1, 2} | cover | containCopy the code
Go back to my previous articles and you may get more!
- A qualified junior front-end engineer needs to master module notes
- Vue.js pen test questions Solve common business problems
- [Primary] Personally share notes of Vue front-end development tutorial
- A long summary of JavaScript to consolidate the front end foundation
- ES6 comprehensive summary
- Dada front-end personal Web share 92 JavaScript interview questions with additional answers
- [Illustrated, like collection oh!] Re-study to reinforce your Vuejs knowledge
- 【 Mind Mapping 】 Front-end development – consolidate your JavaScript knowledge
- 14 – even liver 7 nights, summed up the computer network knowledge point! (66 items in total)
❤️ follow + like + favorites + comments + forward ❤️, original is not easy, encourage the author to create better articles
Likes, favorites and comments
I’m Jeskson, thanks for your talent: likes, favorites and comments, and we’ll see you next time! ☞ Thank you for learning with me.
See you next time!
This article is constantly updated. You can search “Programmer Doraemon” on wechat to read it for the first time, and reply [information] there are materials of first-line big factories prepared by me, which have been included in this article www.dadaqianduan.cn/#/
Star: github.com/webVueBlog/…
This article is participating in the “Nuggets 2021 Spring Recruitment Campaign”, click to see the details of the campaign