我試圖把僞元素::before
與img
但它只是不會顯示。 (是Bootstrap搞砸了嗎?)之前未按預期工作
我看過其他答案,並試圖把content = "something"
,但它仍然不會顯示。
我也試過display: block
,但它仍然保持隱形狀態。
這裏的HTML
<header class = "header container-fluid navbar navbar-fixed-top navbar-inverse">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Anime</a></li>
<li><a href="#">Manga</a></li>
<li><a href="#">Games</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<ul class="dropdown-menu">
<li>
<a data-toggle="modal" data-target="#myModal" >Log-In</a>
</li>
<li><a href="#">Sign-Up</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Watch Paralax</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</header><!-- end of header-->
<!-- MAIN IMAGE -->
<div class = "container">
<img class = "img-responsive main-pic" src="http://vignette4.wikia.nocookie.net/naruto/images/d/dc/Naruto's_Sage_Mode.png/revision/latest?cb=20150124180545" alt = "naruto">
</div>
這裏的CSS
img{
margin-top:70px;
border-radius:10px;
}
img::before{
content:"This is not working";
color:black;
font-size:200px;
}
https://makandracards.com/makandra/8417-you-cannot-use-before-or-after-on-img-in-css –