Skip to content

Instantly share code, notes, and snippets.

@e96031413
Last active June 12, 2020 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e96031413/10b1496aeda708da8b6d8ac29f74bd95 to your computer and use it in GitHub Desktop.
Save e96031413/10b1496aeda708da8b6d8ac29f74bd95 to your computer and use it in GitHub Desktop.
在html中針對一個小block自定義CSS效果
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.google-review-img{
background-color: #2693B0;
text-align: center;
display: block;
max-width:100%;
width:100%;
}
<!-- RWD功能:寬度小於479px的裝置,google-review-img class中的img標籤,圖片大小設定為300px -->
@media screen and (max-width: 479px) {
.google-review-img img {
max-width: 300px;
}
}
</style>
<div class="google-review-img">
<img src="assets/images/placeholders/google-review.png" alt="Google Review">
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment