Yohei Umezu
Yohei Umezu

Reputation: 431

Laravel design. How to show retrieved tags

I have an event information page, and I retrieved tags data from my table. But

I cannot show tags one by one.

Do I need any Javascript ? If I need,

I strongly prefer using vanilla Javascript

, not jquery such as select2 plugin.

I tried many kinds of way by CSS but all the tags are appeared in w3-tag class.

show.blade.php

<div class="tag-group">
      Tags: <span class="w3-tag">
           @foreach($post->tags as $tag) {{ $tag->name }} @endforeach
             </span>
 </div>

main-info.css

.tag-group {
  margin-top: 1rem;
  color: white;
  margin-bottom: 2px;
}

.w3-tag {
  font-size: 14px;
  margin-top: 5px;
  margin-left: 0.5rem;
  padding: 3px;
  color: white;
  background-color: #626263;
  border-radius: 6px;
  text-align: center;
}

Upvotes: 0

Views: 53

Answers (1)

Vikash
Vikash

Reputation: 3561

Try this

<div class="tag-group">
  Tags:
@foreach($post->tags as $tag)
 <span class="w3-tag">
       {{ $tag->name }
 </span>
 @endforeach
</div>

Upvotes: 1

Related Questions