Home > Web Front-end > CSS Tutorial > CSS self-aligning property

CSS self-aligning property

WBOY
Release: 2023-08-30 19:01:06
forward
1110 people have browsed it

CSS 自我对齐属性

Use the align-self attribute to set the alignment of any flex item. You can try running the following code to implement the align-self property of CSS

Example

Live Demonstration

<!DOCTYPE html>
<html>
   <head>
      <style>
         .mycontainer {
            display: flex;
            height: 300px;
            background-color: orange;
         }
         .mycontainer > div {
            background-color: white;
            text-align: center;
            line-height: 90px;
            font-size: 40px;
            width: 100px;
            margin: 50px;
         }
      </style>
   </head>
   <body>
      <h1>Quiz</h1>
      <div class = "mycontainer">
         <div>Q1</div>
         <div>Q2</div>
         <div>Q3</div>
         <div style = "align-self: center">Q4</div>
         <div>Q5</div>
      </div>
   </body>
</html>
Copy after login

The above is the detailed content of CSS self-aligning property. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template