iT邦幫忙

2021 iThome 鐵人賽

DAY 19
1
Modern Web

30天以設計+切版實作(Adobe XD、Bootstrap 5)系列 第 19

【設計+切版30天實作】|Day19 - 切版 - Heroheader - 怎麼切出滿版heroheader?

大綱

前半段都在設計,今天開始就要進行切版了!(緊張!!!)那我們header的部分分成heroheader和navbar,今天的任務是切「Heroheader」的「背景圖」和「標題、內容、intput、btn」。Navbar的部分等明天再來完成唷!
(下方是header的設計稿)
https://ithelp.ithome.com.tw/upload/images/20211003/20139489Ui7Vup2dLp.png

數據收集

header標題的樣式

  • Font-weight:Bold
  • Font-size:40px
  • Text-color:$Secondary
    https://ithelp.ithome.com.tw/upload/images/20211003/20139489Fh0uV8qe3t.png

header內文的樣式

  • Font-weight:Normal
  • Font-size:24px
  • Text-color:$Secondary
    https://ithelp.ithome.com.tw/upload/images/20211003/201394899nAd5bAATm.png

input的placeholder樣式

  • Font-weight:Regular
  • Font-size:16px
  • Text-color:$Secondary , 60%
    https://ithelp.ithome.com.tw/upload/images/20211003/20139489ZylVrPlKaj.png

header標題的margin-top:173px

https://ithelp.ithome.com.tw/upload/images/20211003/20139489shZ4PWsKAy.png

header標題的margin-bottom:24px

https://ithelp.ithome.com.tw/upload/images/20211003/201394893nTgA8lFy8.png

header內文的margin-bottom:40px

https://ithelp.ithome.com.tw/upload/images/20211003/20139489s3TbOP5xp0.png

header input的margin-right:16px

https://ithelp.ithome.com.tw/upload/images/20211003/20139489LrdS8rg69G.png

header input的padding

  • padding-y:12px
  • padding-left:24px

https://ithelp.ithome.com.tw/upload/images/20211003/20139489CBLy3WEDcc.png


步驟

先開一個新區塊

https://ithelp.ithome.com.tw/upload/images/20211003/20139489FBRcrQDQVM.png

  1. 開啓<section> ,命名為heroheader
  2. 另外在後面加入背景img,並加入
<section class="heroheader" style="background-image: url(style/PHOTO/bg_header.png)">
</section>

由於背景圖必須在最底層,所以我們來幫他客製化一下

  1. 在style資料夾裡新增一個客製化的scss,命名為_heroheader.scss
  2. _heroheader.scss 裡新增.heroheader的客製化

https://ithelp.ithome.com.tw/upload/images/20211003/20139489TT3iNA0HoT.png

.heroheader{
  background-size:cover;
  background-repeat: no-repeat;
  z-index: -1;
  padding-bottom: 245px;
}

回到html,在<img>下方新增container和Grid Row with Column。

*注意:設計稿上的文字是佔col-7,另外是從右到左喔,因此要在row加上justify-content-end

https://ithelp.ithome.com.tw/upload/images/20211003/20139489HWRRY3Glpd.png

<section class="intro heroheader">
  <div class="container">

			<!--文字從右到左-->
      <div class="row justify-content-end">

					<!--佔7欄-->
          <div class="col-xl-7"></div>
      </div>
  </div>
</section>

客製「標題」、「內容」、「input」、「btn」的樣式

<h1 class="text-secondary">自由教練,離你不遠!</h1>
<p class="text-secondary fs-4 fw-light">在這個預約系統裡,你們可以在「學員配對區」尋找符合自己要求的學員進行配對,預約成功後,在預訂時間與學員相約在健身場地進行教學就可以了!</p>
<input class="py-3 ps-6 bg-transparent border-1 border-secondary me-5" style="width: 73%;" type="text" placeholder="Enter your email address ...">
<button class="btn btn-primary py-3 border-0 fw-light">立即註冊</button>
  1. 另外在_heroheader.scss新增.hero-margin

https://ithelp.ithome.com.tw/upload/images/20211003/20139489JFU7ZiIvRu.png

```scss
.hero-margin{
    margin-top: 173px;
}
```
  1. 在標題、內容、input、btn外層的<div class="row">加入hero-margin 的class名稱

      <div class="row justify-content-end hero-margin"></div>
    

在裡面加入剛客製完的標題、內容、input、btn

<section class="intro heroheader">
	<div class="container">

		<!-- 加上客製化"hero-margin"的class名稱 -->
    <div class="row justify-content-end hero-margin">
      <div class="col-lg-7">

				<!-- header的標題、內容、input、btn -->
				<h1 class="text-secondary">自由教練,離你不遠!</h1>
				<p class="text-secondary fs-4 fw-light">在這個預約系統裡,你們可以在「學員配對區」尋找符合自己要求的學員進行配對,預約成功後,在預訂時間與學員相約在健身場地進行教學就可以了!</p>
				<input class="py-3 ps-6 bg-transparent border-1 border-secondary me-5" style="width: 73%;" type="text" placeholder="Enter your email address ...">
				<button class="btn btn-primary py-3 border-0 fw-light">立即註冊</button>  
      
			</div>
    </div>
  </div>

</section>

結論

https://ithelp.ithome.com.tw/upload/images/20211003/20139489vUlZX4CptH.png

登登登登,Heroheader的區塊就完成啦!因為目前還沒做好navbar,所以看起來有點怪怪的,等明天把navbar加上去就可以有美美的header了~
那明天再來切下一個東東吧!/images/emoticon/emoticon08.gif


上一篇
【設計+切版30天實作】|Day18 - Bootstrap的客製化
下一篇
【設計+切版30天實作】|Day20 - Navigation bar - 打破預設的navbar排版
系列文
30天以設計+切版實作(Adobe XD、Bootstrap 5)30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言