【发布时间】:2016-10-31 13:11:00
【问题描述】:
所以,在过去的一个小时里,我一直在尝试使用 css 属性 position 移动这张图片。我的问题是每次我使用top 或bottom 移动它时,它都无法正常工作。这是before 使用上述属性和after 的屏幕截图。您可以在下面找到我的 html 和 css。最后,这个position 必须是absolute,否则图像会完全消失。
HTML
<section class="row posts">
<div class="col-md-6 col-md-offset-3">
<header><h3>What others have to say...</h3></header>
@foreach($posts as $post)
<article class="post" data-postid="{{ $post->id }}">
<p>{{ $post->body }}</p>
<div class="info">
Posted by {{ $post->user->user_name }} on {{ $post->created_at }}
</div>
<div class="interaction">
<a href="#" class="like heart"></a> |
<a href="#" class="like">Dislike</a>
@if(Auth::user() == $post->user)
|
<a href="#" class="edit">Edit</a> |
<a href="{{ route('post.delete', ['post_id' => $post->id]) }}">Delete</a>
@endif
</div>
</article>
@endforeach
</div>
</section>
CSS
.heart{
background: url('http://localhost:8079/uncaughterror/public/src/img/web_heart_animation.png');
background-position: left;
background-repeat: no-repeat;
height: 50px; width: 50px;
cursor: pointer;
position: absolute;
left: 12px;
bottom: 5px; //This or 'top' is what causes my entire problem
background-size:1450px;
}
.heart:hover {
background-position: right;
}
【问题讨论】:
标签: html css laravel laravel-5 blade