以 Youtube 為例,需先取得該影音的 ID;同樣適用於 Vimeo, SlideShare

Responsive embeds by Anders Andersen

HTML

 

CSS:

.embed-container {
	position: relative;
	padding-bottom: 56.25%; /* 16/9 ratio */
	padding-top: 30px; /* IE6 workaround*/
	height: 0;
	overflow: hidden;
}
	
.embed-container iframe,
.embed-container object,
.embed-container embed {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

 

Go to top