new way 1:
.picWrap { position: relative; }
.picWrap img { position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; }
======================================================================
new way 2:
.picWrap { position: relative; display: block; }
.picWrap img {
position: absolute; top: 50%; left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%); /* IE 9 */
-webkit-transform: translate(-50%, -50%); /* Chrome, Safari, Opera */
}
SEARCH !!
2015/01/16
2014/08/04
CSS SHAPE
- cross -
<div id="cross"></div>
#cross { width: 100px; height: 100px; position: relative; }
#cross:before,
#cross:after { content: ""; position: absolute; /*z-index: -1;*/ background: #d00; }
#cross:before { left: 50%; width: 30%; margin-left: -15%; height: 100%; }
#cross:after { top: 50%; height: 30%; margin-top: -15%; width: 100%;}
*****************************************************************************************
<div id="cross"></div>
#cross { width: 100px; height: 100px; position: relative; }
#cross:before,
#cross:after { content: ""; position: absolute; /*z-index: -1;*/ background: #d00; }
#cross:before { left: 50%; width: 30%; margin-left: -15%; height: 100%; }
#cross:after { top: 50%; height: 30%; margin-top: -15%; width: 100%;}
*****************************************************************************************
2014/03/18
youtube 影片 responsive
<div class="video-container">
<iframe src="http://www.youtube.com/embed/dFVxGRekRSg" frameborder="0" width="560" height="315"></iframe>
</div>
==========================================================
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px; height: 0; overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
- See more at: http://avexdesigns.com/responsive-youtube-embed/#sthash.JbxIKmLI.dpuf
- See more at: http://avexdesigns.com/responsive-youtube-embed/#sthash.JbxIKmLI.dpuf
- See more at: http://avexdesigns.com/responsive-youtube-embed/#sthash.JbxIKmLI.dpuf
- See more at: http://avexdesigns.com/responsive-youtube-embed/#sthash.JbxIKmLI.dpuf
- See more at: http://avexdesigns.com/responsive-youtube-embed/#sthash.JbxIKmLI.dpuf
- See more at: http://avexdesigns.com/responsive-youtube-embed/#sthash.JbxIKmLI.dpuf
- See more at: http://avexdesigns.com/responsive-youtube-embed/#sthash.JbxIKmLI.dpuf
<iframe src="http://www.youtube.com/embed/dFVxGRekRSg" frameborder="0" width="560" height="315"></iframe>
</div>
==========================================================
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px; height: 0; overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.video-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;}.video-container iframe,.video-container object,.video-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%;}.video-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;}.video-container iframe,.video-container object,.video-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%;}.video-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;}.video-container iframe,.video-container object,.video-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%;}.video-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;}.video-container iframe,.video-container object,.video-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%;}.video-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;}.video-container iframe,.video-container object,.video-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%;}.video-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;}.video-container iframe,.video-container object,.video-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%;}.video-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;}.video-container iframe,.video-container object,.video-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%;}2014/01/27
關於文字爆出去
-- text-overflow --
文字超出邊界時的處理方法,須配合 overflow: hidden; 和 white-space: nowrap; 使用。可設為:
--> overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
clip:切去超出的部分不顯示,此為預設值。
ellipsis:用 "..." 表示後面還有文字未顯示出來。
ellipsis-word:使用 "a€|" 表示後面還有文字未顯示出來。主要瀏覽器都沒支援此項。
inherit:繼承父元素的特徵值。
***************************************************************************************************
-- white-space --
文字中的空白的處理方法。空白字包括:空白,TAB,跳行字(line feed, carriage return, form feed)。可設為:
normal:連續的空白字都縮減為一個空白,長行遇到右邊界會跳行分為兩行,此為預設值。
pre:不縮減空白字,維持原狀。
pre-line:Firefox, Safari, Chrome 的定義是,連續的空白字會縮減為一個空白;跳行字(newline)保留,會跳行;長行也會跳行。IE 的定義是,連續的跳行會保留。
pre-wrap:Firefox, Safari, Chrome 的定義是,不縮減空白字;跳行字會跳行;長行也會跳行。IE 的定義是,連續的跳行字會縮減為一個跳行。
nowrap:連續的空白字會縮減為一個空白,不跳行。
inherit:繼承父元素的特徵值。
***************************************************************************************************
-- word-wrap --
指定是否可以將完整的長字分為二,以免長字超出邊界。適用於英文,通常英文用音節規則來斷字。可設為:
break-word:可以任意斷字,不依循音節規則。
normal:長字會維持原狀,超出邊界,此為預設值。
inherit:繼承父元素特徵。
使用此項,必須先將 text-wrap 特徵設為 normal 或 suppress。例外的是 IE 沒有 text-wrap,一律可以用此項。
***************************************************************************************************
-- word-break --
word-break 屬性主要是用來設定亞洲語言(Chinese, Japan, Korea)及非亞洲語言文字的斷行規則。
normal Break words according to their usual rules
break-all Lines may break between any two letters
keep-all Breaks are prohibited between pairs of letters
2014/01/02
如何讓 div 維持正方形
如何讓 div維持正方形
利用padding可以吃 width % 的值去推開
這樣寬高就會有相同的依據
EX:
width: 50%;
height: 0;
padding-bottom: 50%; <-- 會以width為基準的20%延伸:
padding-bottom: 75%; /* 4:3 aspect ratio */
也可用 :before 或 :after 去塞一個 padding-bottom: 50%; 的東西
利用padding可以吃 width % 的值去推開
這樣寬高就會有相同的依據
EX:
width: 50%;
height: 0;
padding-bottom: 50%; <-- 會以width為基準的20%延伸:
padding-bottom: 75%; /* 4:3 aspect ratio */
也可用 :before 或 :after 去塞一個 padding-bottom: 50%; 的東西
2010/02/26
10 golden rules for building successful web apps, from Fred Wilson
Fred Wilson from Union Square Ventures opened up Future of Web Apps in Miami this morning with his top ten tips for creating a successful web app:
訂閱:
文章 (Atom)