Tuan Hoang
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • 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
    --- title: Panther - Full stack Bootcamp - S5 Color & Images tags: Panther, LearnWorld, Fullstack, HTML-CSS --- # CSS - Colors and Images ## Colors CSS4 supports for a set of [140 color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value): ![css_color_names](https://i.imgur.com/6DFIcih.png) Names are easy, but as you can see, they are limited. By far, the most common way to specify a color is by its **RGB value**. It also gives you millions of colors to choose from. ![css_rgb_model](https://i.imgur.com/YgLF65X.png) CSS allows RGB color values to be specified in a number of formats: ``` color: rgb(200, 178, 230); ``` You can also list them as percentage values, although that is less common: ``` color: rgb(78%, 70%, 90%); ``` Or, you can provide the six-digit hexadecimal version ``` color: #C8B2E6; ``` If your value happens to be made up of three pairs of double digits or letters, such as ``` color: #FFCC00; or color: #993366; ``` you can condense each pair down to one digit or letter ``` color: #FC0; or color: #936; ``` **Picking a color** - One quick and easy option is to go to Google.com and search "color picker". - [Cool Flat UI colors](http://flatuicolors.com/) - Even more [cool colors](http://getuicolors.com/) - Find [variations of colors](http://www.0to255.com/) **RGBa Color** RGBa color allows you to specify a color and make it as transparent or as opaque as you like. The “a” in “RGBa” stands for alpha, which is an additional channel that controls the level of transparency ![css_rgba](https://i.imgur.com/kOdLNit.png) ## Images - Basically all free images in [one place](http://thestocks.im/) - [Unsplash](https://unsplash.com/), a must see - [Food images](http://foodiesfeed.com/) ## Working with the background When it comes to the `background` property; it's, in fact, a shorthand for eight properties: | Property | Description | | :---------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `background-image` | Specifies an image from a file or a generated color gradient. | | `background-position` | Sets the initial position of the background image. | | `background-size` | Specifies how large to render the background image within the element. | | `background-repeat` | Determines whether to tile the image if necessary to fill the entire element. | | `background-origin` | Determines whether background positioning is relative to the element’s border-box, padding-box (initial value), or content-box. | | `background-clip` | Specifies whether the background should fill the element’s border-box (initial value), padding-box, or content-box. | | `background-attachment` | Specifies whether the background image will scroll up and down along with the element (the initial value), or if the image will be fixed in place in the viewport. Note that using the value fixed can have negative performance implications on the page. | | `background-color` | Specifies a solid background color. This will render behind any background image. | ### Gradients **Linear gradient** A white to blue **linear gradient**: ``` background-image: linear-gradient(to right, white, blue); ``` The `linear-gradient` function has three parameters defining its behavior: angle, starting color, and ending color. You can also use other color syntaxes, such as `hex (#0000ff)`, `RGB (rgb(0, 0, 255))`, or the `transparent` keyword. For more precise control of the angle, you can use more specific units, such as degrees. The value `0deg` points straight up (equivalent to to top); higher values move clockwise around the circle, so `90deg` points to the right, `180deg` points down, `360deg` points up again. You can insert more color stops by adding more colors to the linear-gradient() function. ```css background-image: linear-gradient(90deg, red, white, blue); ``` You can use `repeating-linear-gradient()` to create stripes in CSS. Example: ```css .fade { height: 1em; width: 400px; background-image: repeating-linear-gradient( -45deg, #57b, #57b 10px, #148 10px, #148 20px ); border-radius: 0.3em; } ``` **Radial gradient** ```css .fade { height: 200px; width: 400px; background-image: radial-gradient(white, blue); } ``` By default, the gradient is centered in the element, transitioning evenly to its corners. More examples: ![css_radial_gradient](https://i.imgur.com/ebui9zt.png) ## Shadows Two properties that create shadows are `box-shadow`, which creates a shadow of an element’s box shape, and `text-shadow`, which creates a shadow of rendered text. ![](https://i.imgur.com/x0UUFMo.png) Example: ```css .button { padding: 1em; border: 0; font-size: 0.8rem; color: white; border-radius: 0.5em; background-image: linear-gradient(to bottom, #57b, #148); box-shadow: 0.1em 0.1em 0.5em #124; } .button:active { box-shadow: inset 0 0 0.5em #124, inset 0 0.5em 1em rgba(0, 0, 0, 0.4); } ``` The inset shadow adds a ring of shade inside the edges of the element. Button with flat appearance ```css .button { padding: 1em; border: 0; color: white; background-color: #57b; font-size: 1rem; padding: 0.8em; box-shadow: 0 0.2em 0.2em rgba(0, 0, 0, 0.15); } .button:hover { background-color: #456ab6; } .button:active { background-color: #148; } ``` ## Blend modes When you apply multiple background images, those listed first render in front of those listed afterward. The blend modes control the way stacked images blend together. ### Tinting an image ![Blend mode tinting](https://i.imgur.com/cG0MfmH.png) ```html <div class="blend"></div> ``` ```css .blend { min-height: 400px; background-image: url("images/bear.jpg"); background-color: #148; background-size: cover; background-repeat: no-repeat; background-position: center; background-blend-mode: luminosity; } ``` Blend modes in five basic categories | Type of effect | Blend modes | Description | | :------------- | :---------- | :--------------------------------------------------------------------------------------------------- | --- | ---------- | -------------------------------------------- | | Darken | multiply | The lighter the front color, the more the base color will show through. | | | darken | Selects darker of the two colors. | | color-burn | Darkens the base color, increasing contrast. | | Lighten | screen | The darker the front color, the more the base color will show through. | | | lighten | Selects the lighter of the colors. | | | color-dodge | Lightens base color, decreasing contrast. | | Contrast | overlay | Increases contrast by applying multiply to dark colors and screen to light colors, at half strength. | | | hard-light | Greatly increases contrast. Like *overlay*, but applies multiply or screen at full strength. | | | soft-light | Similar to hard-light, but uses burn/dodge instead of multiply/screen. | | Composite | hue | Applies hue from the top color onto the bottom color. | | | saturation | Applies saturation from the top color onto the bottom color. | | | luminosity | Applies luminosity from the top color onto the bottom color. | | | color | Applies hue and saturation from the top color onto the bottom color. | | Comparative | difference | Subtracts the darker color from the lighter one. | | | exclusion | Similar to difference, with less contrast. | ### Adding texture to image ![CSS Blend Mode scratch](https://i.imgur.com/QXnUppw.png) ![CSS Blend Mode Texture](https://i.imgur.com/i7WJT2d.png) ```css .blend { min-height: 400px; background-image: url("images/scratches.jpg"), url("images/bear.jpg"); background-size: 200px, cover; background-repeat: repeat, no-repeat; background-position: center center; background-blend-mode: soft-light; } ``` ### `mix-blend-mode` Although the `background-blend-mode` property lets you blend multiple images, it’s limited to the background colors or images of one element. Another property, `mix-blend-mode`, lets you blend multiple elements. HTML: ```html <div class="blend"> <h1>Ursa Major</h1> </div> ``` CSS: ```css .blend { background-image: url("images/bear.jpg"); background-size: cover; background-position: center; padding: 5em 0 10em; } .blend > h1 { margin: 0; font-family: Helvetica, Arial, sans-serif; font-size: 6rem; text-align: center; mix-blend-mode: hard-light; background-color: #c33; color: #808080; border: 0.1em solid #ccc; border-width: 0.1em 0; } ``` ![CSS Mix Blend](https://i.imgur.com/vYPfhoX.png) ## Additional reading - [Text on Images](https://css-tricks.com/design-considerations-text-images/) - [Beautiful gradients for webdesign](http://uigradients.com/) - [Stripes in CSS](https://css-tricks.com/stripes-css/) - [MDN Radial Gradient](https://developer.mozilla.org/en-US/docs/Web/CSS/radial-gradient) - [CSS Gradient](https://cssgradient.io/)

    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 Google 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