Chih-Wei Lin
    • 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

      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.
      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
    • Engagement control
    • 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 Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control 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

    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.
    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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Sketch to CSS ## 學習來源 * youtube影片:[從 Sketch 設計到 CSS 切版](https://www.youtube.com/watch?v=ev9bGi_XCqU) * codepen案例:[0913 demo](https://codepen.io/Wcc723/pen/zEYXdN) ## 使用工具 * [Sketch](https://www.sketchapp.com/):UI 設計軟體 (補充youtube影片:[六角學院 - Sketch 介紹](https://www.youtube.com/watch?v=dxUR0kfidb0&t=18s)) * [Codepen](https://codepen.io/pen/tour/welcome):線上編譯器 ## 編譯器初始化設定(Pen Settings) #### step1.CSS設定為SCSS ![](https://i.imgur.com/oXcTelN.png) #### step2.載入icon服務 可以手動直接將下方CDN貼到基本設定欄位中。或是透過畫面中內建的搜尋功能,搜尋:**Font-Awesome**,CDN將自動被加入欄位中。 ``` https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css ``` ![](https://i.imgur.com/mflf3CE.png) #### step3.設定完成(Save&Close) ## 正式開始切版 #### 切版呈現目標 ![呈現目標](https://i.imgur.com/u2QCSVA.png) #### 背景色設定 step1.(SCSS語法)將顏色命名為一個變數 ```sass $bg-color1: #FCF4ED; $bg-color2: #F0C7B2; ``` step2.設計漸層背景 ```css body{ height:100vh;/*body設定為裝置高度的100%*/ background-image:linear-gradient(175deg,$bg-color1,$bg-color1 50%,$bg-color2 50%) /*角度175度,開始色,開始色比例,結束色比例*/ } ``` #### 中間卡片基本設定 step1.先在html中給他一個命名,名為**card** ```htmlmixed <div class="card"></div> ``` step2.在css中定義**card**的基本樣式 ```css .card{ background-color:#fff; padding:15px; height:60vh; width:600px; } ``` step3.加入:**box-sizing**屬性 ==當你設定一個元素樣式為 **box-sizing**: border-box;,這個元素的內距和邊框將不會增加元素本身的寬度。== ```css .card{ box-sizing:border-box; } ``` 或者可以用*{},代表對所有元素統一做設定 ```css *{ box-sizing:border-box;; } ``` ![](https://i.imgur.com/iUUsnfc.png) step4.為**card**添加陰影 ```cass $card-box-shadow: 0 4px 30px #979797; ``` ```cass .card{ box-shadow:$card-box-shadow; } ``` step5.如何讓**card**置中整個畫面呢?在**body**中加入對齊的設定! ```css body{ display:flex;/*彈性布局*/ justify-content:center;/*//水平置中*/ align-items:center;/*垂直置中*/ } ``` #### 卡片內圖片 step1.先在html中給予一個畫面空間 ```htmlmixed <div class="card"> <div class="brand-bg"></div><!--新增這個div作為圖片空間 --> <h1>About JENDES</h1> </div> ``` step2.先將父元素card定位 ```css .card{ position:relative; } ``` step3.再將子元素brand-bg(遮色片)定位 ```css .brand-bg{ position:absolute;/*相較於父元素的定位方式 */ left:0; top:0; bottom:0; width:445px; } ``` step4.載入圖片url,並相較於遮色片做定位 ```css .brand-bg{ background-image:url(https://images.unsplash.com/photo-1550939810-cb345b2f4ad7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2632&q=80); background-size:527px 633px;/*載入圖片的尺寸 */ background-position:-41px -10px;/*相較於遮色片的定位 */ } ``` step5.遮色片作梯形切割 ```css .brand-bg{ clip-path:polygon(0 0, 339.05px 0,445px 100%,0% 100%); /*四個點的位置依序是 左上,右上,右下,左下*/ } ``` #### 卡片內文字 step1.先在html中給文字一個區塊畫面 ```htmlmixed= <div class="card"> <div class="brand-bg"></div> <div class="card-block"> <div class="card-header"> <h1>About JENDES</h1> </div> <div class="card-body"> <p>粉橘色,一個溫柔又有個性的顏色。 <br/>柔和色相的背後蘊含著明亮活潑的橘彩,卻同時調入了冷靜灰階。 <br/>有如生活中的我們,一人扮演著多種角色,每個角色充滿著層次、彈性,無法輕易僅以黑白雙色定義。 </p> <p>讓每道顏色都能在這找到適合的穿著,舒服展現每一個自己。 <br/>由裡到外,穿出自信自在。 </p> <p>When style shines from inside, no one can define you. <br/>You are just who you are. </p> </div> <div class="card-footer"> <a href="#" class="btn">+電子報訂閱</a> </div> </div> ``` ==p標籤代表文字段落== ==br標籤代表斷行== step2.定位文字區塊相較於card的位置 ```css .card-block{ width:318px; /*設定右方文字在左方圖層上面 */ position:relative; x-index:3; /*設定裡面的物件排列為flex*/ /* flex預設是由左至右,可以調整flex-direction:column,改為由上到下== */ display:flex; flex-direction:column; } ``` ==flex跟position是可以一起使用的,兩個沒有關係;float跟display也沒有關係;flex裡面可以再有flex== step3.設定**card-footer**定位在區塊的最下方 ```css .card-footer{ /*使用auto會自動將空間用空白補滿*/ margin-top:auto; } ``` step4.設定**btn**樣式 ```cass $btn-color:#D8D8D8; .btn{ background-color:$btn-color; color:#000000; width:292px; padding-top:0.5rem; padding-bottom:0.5rem; display:block;/*設定區塊元素 */ text-decoration:none; text-align:center; } ``` ==display:block - **區塊元素**,元素會以區塊方式呈現。一個區塊元素會讓其內容從新的一行開始顯示,並盡可能的撐滿容器。== ==display:inline - **行內元素**,所有文字或圖片均不換行,也就是全部都會是同一行的意思。== step5.設定**btn**的動態hover樣式變化 ```cass .btn{ background-color:$btn-color; &:hover,&:focus{ background-color:darken($btn-color,15%); } } ``` step6.設定內文字體 ```css h1{ font-size:32px; font-weight:bolder; } .card-header{ color:#AD5E36; font-family:cursive; font-weight:bold; } p{ font-size:16px; margin-top:16px; line-height: 20px; } .card-body{ font-family:"STXihei","FangSong",cursive; color:#6D7278; } ``` 參考資料:[CSS 常用中文字型 (Traditional Chinese font family) ](http://blog.ja-anything.com/2016/11/25/css-%E5%B8%B8%E7%94%A8%E4%B8%AD%E6%96%87%E5%AD%97%E5%9E%8B-traditional-chinese-font-family/) step7.加上簽名圖片 ```cass .sign-image{ margin-left:203px; margin-top:16px; width:115px; height:39px; background-image:url(https://www.jendesstudio.com/front/assets/images/jenwu.png); background-size:115px 39px; } ``` ## 結果呈現 * [codepen編譯檔](https://codepen.io/leah-lin/pen/YgKjdZ) * [github打包檔](https://github.com/lehlin912/practice_css_slicingUI_0226-)

    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

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    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