我管理一個網站,其中有一個左對齊的徽標。中心徽標響應兩類
爲標誌的HTML和CSS正在尋找這樣的:
HTML
<div class="logo-container">
<a href="@homePage.Url">
<img src="/img/logo-white.svg" data-svg-fallback="/img/logo-white.png" alt="@logoAltText" class="img-responsive logo"/>
</a>
</div>
CSS
@mixin img-responsive($display: block) {
display: $display;
max-width: 100%; // Part 1: Set a maximum relative to the parent
height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
}
我不得不做出的LandingPage標識被居中。所以我覺得在我的LandingPage我能做到像這樣:
HTML
<div class="logo-container">
<a href="@homePage.Url">
<img src="/img/logo-white.svg" data-svg-fallback="/img/logo-white.png" alt="@logoAltText" class="landingpage img-responsive logo"/>
</a>
</div>
CSS
.landingpage img-responsive logo {
margin: 0 auto;
}
是不正確的?
使用這種.landingpage.img-responsive.logo { 保證金:0汽車; } – San