Chanakya
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # CSS Flex Box Documentation --- **CSS Flexbox**, or the Flexible Box Layout, is a layout model that allows you to design responsive web layouts more easily and efficiently. It provides a way to distribute space among items in a container, even when their sizes are unknown or dynamic. Flexbox is particularly useful for creating one-dimensional layouts, either in a row or a column. - **Flex Container**: The parent element that holds flex items. You make a container a flex container by setting its display property to flex or inline-flex. - Flex Items: The direct children of a flex container that will be arranged according to the flexbox model. ## Properties of CSS Flex Box 1. Flex-basis 2. Flex-grow 3. flex-shrink >``` > **Flex-basis** This property defines the initial size of a flex item before any space distribution takes place. It can be set to a specific length (like 100px), a percentage (like 50%), or auto, which means the item's size will be based on its content. > **Refer Image** > **<https://drive.google.com/file/d/1dPZvsa2yzb6GCwUvLTzimQ37CO3f5Uby/view?usp=drive_link>** ```css .item { flex-basis: 200px; } ``` > **Flex-grow** This property determines how much a flex item should grow relative to the rest of the flex items in the container when there is extra space available. It accepts a unitless number (usually between 0 and 1). A value of 0 means the item will not grow, while a higher value means it will take up more space. > **Refer Image** > **<https://drive.google.com/file/d/1HyfTlT1q_zVLQe7ip-HaKXHPV0Uz1P18/view?usp=drive_link>** ```css .item { flex-grow: 1; /* This item will take up available space */ } ``` > **Flex-shrink** This property defines how much a flex item should shrink relative to other flex items when there isn't enough space. Like flex-grow, it also accepts a unitless number. A value of 1 means the item can shrink if needed, while 0 means it will not shrink. > **Refer Image** > **<https://drive.google.com/file/d/19YBaIzXx8r5Bn8JN3mKuXUsYOQND84NU/view?usp=drive_link>** ```css .item { flex-shrink: 1; /* This item can shrink to fit the container */ } ``` > **Combining Properties** These three properties can be combined using the shorthand flex property, which can set flex-grow, flex-shrink, and flex-basis all at once. ```css .item { flex: 1 1 200px; /* grow, shrink, basis */ } ``` # MCQ's --- > 1.**The flex-basis property defines the initial size of a flex item.** a) True b) False > 2.**What property do you use to make an element a flex container?** a) display: block; b) display: flex; c) display: grid; > 3.**Which property determines how much a flex item can grow?** a) flex-shrink b) flex-basis c) flex-grow > 4.**What is the default value of flex-direction?** a) row b) column c) row-reverse > 5.**Match the property with its description:** | Property | Description | --- | --- | A. flex-basis | 1. How much the item can shrink | | B. flex-grow | 2. Initial size of the flex item | | C. flex-shrink | 3. How much the item can grow | 6.**Given the following CSS:** ```css .container { display: flex; } .item1 { flex-basis: 100px; flex-grow: 1; } .item2 { flex-basis: 50px; flex-grow: 2; } ``` >**If there is extra space in the container, which item will take up more space?** a) item1 b) item2 c) Both will take the same space 7.**Given the CSS:** ```css .item { flex-shrink: 0; } ``` > **If the container is smaller than the item, what will happen?** a) The item will shrink b) The item will not shrink c) The item will disappear > 8.**The default value of flex-wrap is __________.** > 9.**The property that controls how flex items are aligned in the main axis is __________.** > 10.**If you have three items with `flex-grow: 1` and one item with `flex-grow: 2`, which item will take up more space when there’s extra room?** a) The first item b) The last item c) All items equally > 11.**Match the flex-direction values with their meanings:** | Value | Meaning | --- | --- | A. row | 1. Items arranged from top to bottom | | B. column | 2. Items arranged from left to right | | C. row-reverse | 3. Items arranged from right to left | ![flex-direction](https://sharkcoder.com/files/article/flex_column.png) > 11.**What is the flex-direction of the flex container?** a) column b) row c) column-reverse ![align-items](https://media.geeksforgeeks.org/wp-content/uploads/20230704175925/chrome-capture-2023-6-4.png) > 12.**What property is used to achieve this alignment?** a) justify-content b) align-items c) flex-direction > 13.**Which of the following properties can be used to control how flex items are displayed on different screen sizes?** a) flex-basis b) media queries c) flex-direction > 14.**What is the purpose of the align-content property?** a) To align individual items within a row b) To align the entire flex container in the main axis c) To align the flex lines within the container 15.**Given the CSS:** ```css .item { flex-grow: 2; } ``` > **What will happen if there is extra space?** a) The item will grow twice as much as items with flex-grow: 1 b) The item will remain the same size c) The item will shrink > 16.**The gap property can only be used in grid layouts, not in flex layouts.** a) True b) False > 17.**The flex-shrink property allows items to grow in size.** a) True b) False > 18.**Which property is used to control the spacing between flex items?** a) gap b) margin c) padding > 19.**Which property would you use to center items horizontally in a flex container?** a) align-items: center; b) justify-content: center; c) align-content: center; > 20.**Which of the following is NOT a value for flex-direction?** a) row b) column c) diagonal > 21.**If you want all items in a flex container to have equal space around them, which value should you use for justify-content?** a) flex-start b) space-between c) space-around > 22.**Match the Flexbox Terms with Their Definitions** | Term | Definition | --- | --- | A. Main axis |1. The axis perpendicular to the main axis | | B. Cross axis |2. The primary direction items are arranged | | C. Flex item | 3. An individual item within a flex container | > 23.**To create space between flex items without using margins, you can use the __________ property in a flex container.** > 24.**The default value of the align-items property is __________.** > 25.**Description:** A flex container with three boxes, one significantly larger than the others. **Question: If the large box has a ``flex-basis set to 200px``, what does this imply?** a) It will only grow to 200px b) It starts at 200px before any growth c) It cannot grow > 26.**Description:** A flex container with three boxes evenly spaced across the width. **Question: Which justify-content value is applied?** a) flex-start b) space-between c) center > 27.**Given this CSS:** ```css .container { display: flex; flex-direction: column; } ``` > **How will the items be arranged?** a) In a row b) In a column c) In a grid > 28.**What will happen if you apply ``flex: 2 1 150px; ``to a flex item?** a) It will grow twice as fast, shrink if necessary, and start at 150px. b) It will not shrink and will always be 150px. c) It will take up all available space. > 29.**Imagine a flex container with ``flex-direction: column`` and three items inside, each with different flex-basis values. What will happen if the container's height is reduced?** a) All items will remain the same size. b) The items will shrink based on their flex-shrink values. c) The largest item will disappear. > 30.**If a flex container has `align-content: space-between` and contains two lines of items, how will the space be distributed?** a) The space will be distributed evenly between the items on each line. b) There will be no space between the lines, and all items will be packed together. c) The space between the two lines will be distributed evenly, with no extra space above the first line or below the last line.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully