😲 完整範例一次搞懂 CSS 行高與垂直置中
CSS 中的行高、垂直置中算容易被忽略
但每次要用卻搞不定的一個屬性
這篇文章透過完整的圖文、程式碼範例
徹底掌握行高問題 👌
#圖文排版都適用
#還有很多隱藏秘訣
出處
http://www.w3cplus.com/css/css-font-metrics-line-height-and-vertical-align.html
同時也有3部Youtube影片,追蹤數超過1萬的網紅小豆,也在其Youtube影片中提到,CSS碼 ↓ /* Background colors*/ body { background-color: rgba(0,0,0,0); } /* Transparent background. */ yt-live-chat-renderer { background-color: tr...
「css line-height」的推薦目錄:
- 關於css line-height 在 卡斯伯 Facebook 的最讚貼文
- 關於css line-height 在 MUKI SPACE INC. Facebook 的最讚貼文
- 關於css line-height 在 小豆 Youtube 的最讚貼文
- 關於css line-height 在 修分靈 Youtube 的精選貼文
- 關於css line-height 在 狗魚 Youtube 的最佳貼文
- 關於css line-height 在 Take line height as unit for width - Stack Overflow 的評價
- 關於css line-height 在 line-height · WebPlatform Docs 的評價
- 關於css line-height 在 CSS Height vs Line-Height - YouTube 的評價
- 關於css line-height 在 line-height issue #788 - necolas/normalize.css - GitHub 的評價
css line-height 在 MUKI SPACE INC. Facebook 的最讚貼文
感謝網頁時光機,讓這篇文章還有重新問世的一天 >_<
之前找不到的圖片都回來啦(撒花)
http://muki.tw/tech/css-line-height/
css line-height 在 小豆 Youtube 的最讚貼文
CSS碼 ↓
/* Background colors*/
body {
background-color: rgba(0,0,0,0);
}
/* Transparent background. */
yt-live-chat-renderer {
background-color: transparent !important;
}
/* Outlines */
yt-live-chat-renderer * {
text-shadow: -2px -2px #000000,-2px -1px #000000,-2px 0px #000000,-2px 1px #000000,-2px 2px #000000,-1px -2px #000000,-1px -1px #000000,-1px 0px #000000,-1px 1px #000000,-1px 2px #000000,0px -2px #000000,0px -1px #000000,0px 0px #000000,0px 1px #000000,0px 2px #000000,1px -2px #000000,1px -1px #000000,1px 0px #000000,1px 1px #000000,1px 2px #000000,2px -2px #000000,2px -1px #000000,2px 0px #000000,2px 1px #000000,2px 2px #000000;
font-family: "Microsoft JhengHei";
font-size: 24px !important;
line-height: 24px !important;
}
yt-live-chat-text-message-renderer #content ,
yt-live-chat-legacy-paid-message-renderer #content {
overflow: initial; !important
}
/* Hide scrollbar. */
yt-live-chat-item-list-renderer #items {
overflow: hidden !important;
}
yt-live-chat-item-list-renderer #item -scroller{
overflow: hidden !important;
}
/* Hide header and input. */
yt-live-chat-header-renderer,
yt-live-chat-message-input-renderer {
display: none !important;
}
/* Reduce side padding. */
yt-live-chat-text-message-renderer,
yt-live-chat-legacy-paid-message-renderer {
padding-left: 4px !important;
padding-right: 4px !important;
}
yt-live-chat-paid-message-renderer #header {
padding-left: 4px !important;
padding-right: 4px !important;
}
/* Avatars. */
yt-live-chat-text-message-renderer #author -photo,
yt-live-chat-paid-message-renderer #author -photo,
yt-live-chat-legacy-paid-message-renderer #author -photo {
width: 30px !important;
height: 30px !important;
border-radius: 30px !important;
margin-right: 7.5px !important;
}
/* Hide badges. */
yt-live-chat-text-message-renderer #author -badges {
display: none !important;
vertical-align: text-top !important;
}
/* Timestamps. */
yt-live-chat-text-message-renderer #timestamp {
color: #999999 !important;
font-family: "Microsoft JhengHei";
font-size: 12px !important;
line-height: 12px !important;
}
/* Badges. */
yt-live-chat-text-message-renderer #author -name[type="owner"],
yt-live-chat-text-message-renderer yt-live-chat-author-badge-renderer[type="owner"] {
color: #ffd600 !important;
}
yt-live-chat-text-message-renderer #author -name[type="moderator"],
yt-live-chat-text-message-renderer yt-live-chat-author-badge-renderer[type="moderator"] {
color: #5e84f1 !important;
}
yt-live-chat-text-message-renderer #author -name[type="member"],
yt-live-chat-text-message-renderer yt-live-chat-author-badge-renderer[type="member"] {
color: #0f9d58 !important;
}
/* Channel names. */
yt-live-chat-text-message-renderer #author -name {
color: #FF9966 !important;
font-family: "Microsoft JhengHei";
font-size: 28px !important;
line-height: 28px !important;
}
yt-live-chat-text-message-renderer #author -name::after {
content: ":";
margin-left: 2px;
}
/* Messages. */
yt-live-chat-text-message-renderer #message ,
yt-live-chat-text-message-renderer #message * {
color: #ffffff !important;
font-family: "Microsoft JhengHei";
font-size: 28px !important;
line-height: 28px !important;
}
/* SuperChat/Fan Funding Messages. */
yt-live-chat-paid-message-renderer #author -name,
yt-live-chat-paid-message-renderer #author -name *,
yt-live-chat-legacy-paid-message-renderer #event -text,
yt-live-chat-legacy-paid-message-renderer #event -text * {
color: #ffd600 !important;
font-family: "Microsoft JhengHei";
font-size: 28px !important;
line-height: 28px !important;
}
yt-live-chat-paid-message-renderer #purchase -amount,
yt-live-chat-paid-message-renderer #purchase -amount *,
yt-live-chat-legacy-paid-message-renderer #detail -text,
yt-live-chat-legacy-paid-message-renderer #detail -text * {
color: #ffd600 !important;
font-family: "Microsoft JhengHei";
font-size: 28px !important;
line-height: 28px !important;
}
yt-live-chat-paid-message-renderer #content ,
yt-live-chat-paid-message-renderer #content * {
color: #ffffff !important;
font-family: "Microsoft JhengHei";
font-size: 30px !important;
line-height: 30px !important;
}
yt-live-chat-paid-message-renderer {
margin: 4px 0 !important;
}
yt-live-chat-legacy-paid-message-renderer {
background-color: #0f9d58 !important;
margin: 4px 0 !important;
}
yt-live-chat-text-message-renderer a,
yt-live-chat-legacy-paid-message-renderer a {
text-decoration: none !important;
}
yt-live-chat-text-message-renderer[is-deleted],
yt-live-chat-legacy-paid-message-renderer[is-deleted] {
display: none !important;
}
yt-live-chat-ticker-renderer {
background-color: transparent !important;
box-shadow: none !important;
}
yt-live-chat-ticker-paid-message-item-renderer,
yt-live-chat-ticker-paid-message-item-renderer *,
yt-live-chat-ticker-sponsor-item-renderer,
yt-live-chat-ticker-sponsor-item-renderer * {
color: #ffd600 !important;
font-family: "Microsoft JhengHei";
}
css line-height 在 修分靈 Youtube 的精選貼文
語法網站:https://chatv2.septapus.com/
兩段語法(請複製貼上更改)
/* Channel names. */
yt-live-chat-text-message-renderer #author-name {
color: #FF9966 !important;
font-family: "Microsoft JhengHei";
font-size: 28px !important;
line-height: 28px !important;
}
/* Messages. */
yt-live-chat-text-message-renderer #message,
yt-live-chat-text-message-renderer #message *,
yt-live-chat-legacy-paid-message-renderer #detail-text,
yt-live-chat-legacy-paid-message-renderer #detail-text * {
color: #ffffff !important;
font-family: "Microsoft JhengHei";
font-size: 28px !important;
line-height: 28px !important;
}
css line-height 在 狗魚 Youtube 的最佳貼文
subgoal: https://agentc0re.com/Sub-Counter
訂閱通知: https://streamlabs.com/
聊天室CSS:
body {
background-color: transparent !important;
}
/* Transparent background. */
yt-live-chat-renderer {
background-color: transparent !important;
}
/* Outlines */
yt-live-chat-renderer * {
text-shadow: -2px -2px #000000,-2px -1px #000000,-2px 0px #000000,-2px 1px #000000,-2px 2px #000000,-1px -2px #000000,-1px -1px #000000,-1px 0px #000000,-1px 1px #000000,-1px 2px #000000,0px -2px #000000,0px -1px #000000,0px 0px #000000,0px 1px #000000,0px 2px #000000,1px -2px #000000,1px -1px #000000,1px 0px #000000,1px 1px #000000,1px 2px #000000,2px -2px #000000,2px -1px #000000,2px 0px #000000,2px 1px #000000,2px 2px #000000;
font-family: "Laila";
font-size: 18px !important;
line-height: 18px !important;
}
yt-live-chat-text-message-renderer #content ,
yt-live-chat-legacy-paid-message-renderer #content {
overflow: initial; !important
}
/* Hide scrollbar. */
yt-live-chat-item-list-renderer #items {
overflow:hidden !important;
}
/* Hide header and input. */
yt-live-chat-header-renderer,
yt-live-chat-message-input-renderer {
display: none !important;
}
/* Reduce side padding. */
yt-live-chat-text-message-renderer,
yt-live-chat-legacy-paid-message-renderer {
padding-left: 4px !important;
padding-right: 4px !important;
}
/* Avatars. */
yt-live-chat-text-message-renderer #author -photo,
yt-live-chat-legacy-paid-message-renderer #author -photo { width: 25px !important;
height: 25px !important;
border-radius: 25px !important;
margin-right: 6.25px !important;
}
/* Hide badges. */
yt-live-chat-text-message-renderer #author -badges {
display: none !important;
vertical-align: text-top !important;
}
/* Timestamps. */
yt-live-chat-text-message-renderer #timestamp { color: #999999 !important;
font-family: "Imprima";
font-size: 16px !important;
line-height: 16px !important;
}
/* Badges. */
yt-live-chat-text-message-renderer #author -name[type="owner"],
yt-live-chat-text-message-renderer yt-live-chat-author-badge-renderer[type="owner"] {
color: #FFCC33 !important;
}
yt-live-chat-text-message-renderer #author -name[type="moderator"],
yt-live-chat-text-message-renderer yt-live-chat-author-badge-renderer[type="moderator"] {
color: #FF9966 !important;
}
yt-live-chat-text-message-renderer #author -name[type="member"],
yt-live-chat-text-message-renderer yt-live-chat-author-badge-renderer[type="member"] {
color: #FF9966 !important;
}
/* Channel names. */
yt-live-chat-text-message-renderer #author -name {
color: #FF9966 !important;
font-family: "Microsoft JhengHei";
font-size: 28px !important;
line-height: 28px !important;
}
yt-live-chat-text-message-renderer #author -name::after {
content: ":";
margin-left: 2px;
}
/* Messages. */
yt-live-chat-text-message-renderer #message ,
yt-live-chat-text-message-renderer #message *,
yt-live-chat-legacy-paid-message-renderer #detail -text,
yt-live-chat-legacy-paid-message-renderer #detail -text * {
color: #ffffff !important;
font-family: "Microsoft JhengHei";
font-size: 28px !important;
line-height: 28px !important;
}
/* Fan Funding Messages. */
yt-live-chat-legacy-paid-message-renderer #event -text {
color: #ffffff !important;
font-family: "Microsoft JhengHei";
font-size: 20px !important;
line-height: 20px !important;
}
yt-live-chat-legacy-paid-message-renderer #detail -text,
yt-live-chat-legacy-paid-message-renderer #detail -text * {
color: #ffffff !important;
font-family: "Imprima";
font-size: 18px !important;
line-height: 18px !important;
}
yt-live-chat-legacy-paid-message-renderer {
background-color: #00ffff !important;
margin: 4px 0 !important;
padding: 4px !important;
}
yt-live-chat-text-message-renderer a,
yt-live-chat-legacy-paid-message-renderer a {
text-decoration: none !important;
}
yt-live-chat-text-message-renderer[is-deleted],
yt-live-chat-legacy-paid-message-renderer[is-deleted] {
display: none !important;
}
____________________________________
♪ Power For Tommorow - http://www.rengoku-teien.com
____________________________________
訂閱狗魚: https://www.youtube.com/channel/UC3X3...
粉絲專頁: https://www.facebook.com/dofi13579/
狗魚精華: https://www.youtube.com/playlist?list...
合作邀約:13825774632p@gmail.com
實況委託: https://docs.google.com/forms/d/1BY8H...
css line-height 在 line-height · WebPlatform Docs 的推薦與評價
The line-height property specifies the height of an inline block level element. ... Animatable: Yes; CSS Object Model Property: lineHeight ... ... <看更多>
css line-height 在 CSS Height vs Line-Height - YouTube 的推薦與評價
There are two different height properties in CSS that sometimes get confused - height and line-height ... ... <看更多>
css line-height 在 Take line height as unit for width - Stack Overflow 的推薦與評價
... <看更多>