Some popular properties of CSS3

Posted by alant on Sun, 20 Feb 2022 18:30:43 +0100

It can load the font text of the server and let the client display the font not installed by the client

• font-family:<Yours web The name of the font>;
src: url("Font path);
  /*Define font*/
  font-family:"My font";
        font-family: "My font"; 
        /*Reference font*/
     font-family: "CooperBlackStd";

Are you still worried about the special border effect?

box-sizing:border-box;Weird box model(Any inner margins and borders you specify for an element will be drawn at the set width and height)

outline Contour effect heel border The rendering effect is very similar, but it does not occupy the space of web page layout. It is rendered when the element takes focus or is activated,You can try the following example.
      width: 100px;
      height: 100px;
      background-color: red;
      border: 10px dashed black;
     width: 100px;
     height: 100px;
     background-color: red;
     outline: 10px dashed black;
     /*box-sizing:border-box Weird box mode
      outline  The contour effect decoration style does not occupy text space*/

Do you still remember the newspaper layout of that year? When your web page style also needs this style, take a look at the following!

Column layout

/Column properties/
column-count: number; Quantity control of columns
Column gap: length unit; Distance between columns
Column rule: width, color; See the separation line between columns, similar to border
/The properties of columns (columns) are divided into several columns/

The following is a code example. Go and try it!

 /*Width between columns*/
    /*Width and color of the divider between columns*/
    -webkit-column-rule:5px dashed red;
    column-rule:5px dashed red;


Flex box: flexible layout


1. It has strong adaptability and is very practical in making interface types with different screen resolutions
2. The width can be adjusted at will. Scale element width and height
3. You can easily change the order of elements
4. Adaptive layout is fast and easy to maintain

Elastic box model

display: box; Layout the child elements of an element in a flexible layout
-webkit-box-orient:vertical; Arrangement order of child elements (horizontal or vertical)
Box direct action: normal | reverse the order of the child elements
-webkit-box-flex:1; How do child elements allocate remaining space
Box align: start | end | center vertical alignment of child elements
Box pack: horizontal alignment of start | end | center child elements
flexbox is a layout module that contains the attributes of parent and child elements
The theme of flexbox layout is that the size of the element changes to adapt to the available space. When the space becomes larger, the flex element will expand to fill the available space. When the flex element exceeds the available space, it will automatically shrink. In short, the flex element can make your layout automatically scale according to the size change of the browser
Flexible layout flex box

Note: horizontal layout is preferred

Code example!!!!!!(If you don't understand it, understand it by yourself)
     margin: 0;
     padding: 0;
     height: 100%;
        height: 100%;
        /*Declare the elastic box model at the parent*/
        display: -webkit-box;
        /*The elastic box model defaults to horizontal layout and can be set to vertical layout*/
    .wrap div{
     /*width: 200px;*/
     /*height: 100px;*/
     /*Set the necessary conditions for the current quick change to elastic model and fill in the remaining content. The parent sets the elastic box model*/
     background-color: yellow;
     /*Fill ratio*/

Author: Senior migrant workers
Source: Jianshu
The copyright belongs to the author. For commercial reprint, please contact the author for authorization. For non-commercial reprint, please indicate the source.

Topics: css3