AdminLTE icon indicating copy to clipboard operation
AdminLTE copied to clipboard

[FEATURE] Demo For Ribbon Over Image

Open caschoff opened this issue 6 years ago • 4 comments

Please add a demo for 'How to place a ribbon over an image'. I can't figure it out, as described here: https://stackoverflow.com/questions/61777903/place-ribbon-over-image-not-responsive

caschoff avatar May 14 '20 06:05 caschoff

Try this code snippet 😄

<div class="position-relative">
    <img src="../../dist/img/photo1.png" alt="Photo 1" class="img-fluid">
    <div class="ribbon-wrapper ribbon-lg">
        <div class="ribbon bg-success text-lg">
            Ribbon
        </div>
    </div>
</div>

REJack avatar May 16 '20 22:05 REJack

Thank you very much! But the ribbon is orientated at the right side of the card. If the image is big enough, this is no problem, but with smaller images.

Bildschirmfoto 2020-05-18 um 08 44 27

Bildschirmfoto 2020-05-18 um 08 45 01

The code with the card looks like this at the moment:

<div class="card">
    <div class="card-body">
        <div class="text-center">
            <a href="../user/albumdetails.html">                                           
                <div class="position-relative">
                    <img class="img-fluid img-thumbnail lozad" data-src="../assets/samples/c1.jpg">
                    <div class="ribbon-wrapper ribbon-xl">
                        <div class="ribbon bg-primary">
                            Sammlung 'Christian'
                        </div>
                    </div>
                </div>
            </a>
            <p class="card-text mt-1">
                Ahmal Jamad<br>
                <strong>Progressive Sessions and the Fath for Atlantis</strong><br>
                <small>6 Tracks - Jazz/Blues - mp3</small>
            </p>
        </div>
    </div>
</div>

caschoff avatar May 18 '20 06:05 caschoff

Oh try to add .d-inline-block beside position-relative, you can add position-relative to your a-tag instead of a div inside the a.

Like this:

<div class="card">
    <div class="card-body">
        <div class="text-center">
            <a href="../user/albumdetails.html" class="position-relative d-inline-block">                                           
                <img class="img-fluid img-thumbnail lozad" data-src="../assets/samples/c1.jpg">
                <div class="ribbon-wrapper ribbon-xl">
                    <div class="ribbon bg-primary">
                        Sammlung 'Christian'
                    </div>
                </div>
            </a>
            <p class="card-text mt-1">
                Ahmal Jamad<br>
                <strong>Progressive Sessions and the Fath for Atlantis</strong><br>
                <small>6 Tracks - Jazz/Blues - mp3</small>
            </p>
        </div>
    </div>
</div>

REJack avatar May 19 '20 19:05 REJack

Sorry for the late response, this worked for me, tanks!

caschoff avatar May 25 '20 09:05 caschoff