Weiter zum Inhalt
  • Aktuell
  • Tags
  • Beliebt
  • Benutzer
  • Suche
Skins
  • Hell
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dunkel
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen

Lay Theme Forum

  1. Übersicht
  2. General Discussion
  3. Easy way to put captions in images

Easy way to put captions in images

Geplant Angeheftet Gesperrt Verschoben General Discussion
6 Beiträge 2 Kommentatoren 1.3k Aufrufe 1 Beobachtet
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • H
    H
    hx
    schrieb am zuletzt editiert von
    #1

    Hello everyone,

    I wonder if there's an easy way to put caption inside the actual image, make it appear as an overlay?

    I've arrived at this:

    .caption{
        transform: translateY(-100%);
        padding: 20px;
    	background: rgba(255, 255, 255, .8);
    	opacity: 0;
    	transition: all 1s ease;
    }
    
    .caption:hover {
    	opacity: 1;
    	transition: all 1s ease;
    }
    

    But it creates an unwanted (white) void at the bottom of the image (where the cation used to be) and also, the caption overlay does not fill the whole image.
    See here. (the website I am working on)

    Any clue how I could further work on this?
    Thanks!

    1 Antwort Letzte Antwort
    0
    • RichardR
      RichardR
      Richard
      Global Moderator
      schrieb am zuletzt editiert von
      #2

      Dear @hx

      Wish to help, however the Link provided does not take me to the website to inspect it sorry :)

      Best
      Richard

      H 1 Antwort Letzte Antwort
      0
      • H
        H
        hx
        schrieb am zuletzt editiert von
        #3

        Hello Richard,

        sorry, weird mistake. It just copied the anchor. This is the website:
        https://stilpunkt.mcelangelo.com/

        I managed to get the caption into the image and style it via this code:

        .img {
        	display:flex;
        	z-index:0;
        }
        
        .caption {
        	padding: 40px;
        	background: rgba(255, 255, 255, .8);
        	opacity: 0;
        	transition: all 1s ease;
        	z-index: 10;
        	overflow: hidden;
        	flex-grow:1;
        }
        
        .caption:hover {
        	opacity: 1;
        	transition: all 1s ease;
        }
        

        However, as soon as the text of the caption reaches the bounds of the image, it overflows, disregarding the overflow:hidden command. Did I forget something? I tried a several other commands (as described here: https://medium.com/@gaurav5430/css-flex-positioning-gotchas-child-expands-to-more-than-the-width-allowed-by-the-parent-799c37428dd6), but to no avail.

        Maybe you have an idea. Thank you very much!

        1 Antwort Letzte Antwort
        0
        • RichardR Richard

          Dear @hx

          Wish to help, however the Link provided does not take me to the website to inspect it sorry :)

          Best
          Richard

          H
          H
          hx
          schrieb am zuletzt editiert von
          #4

          @Richard-Keith Hey Richard, I wonder if you have seen this... but can you point me into the right direction regarding the alignment of the Caption text within the container?

          I'm trying to make it vertically centered as opposed to the top, which is now the case, but I still want the container to fit height and width to the parent (except the 20 px margin).

          Thank you!

          1 Antwort Letzte Antwort
          0
          • RichardR
            RichardR
            Richard
            Global Moderator
            schrieb am zuletzt editiert von
            #5

            Dear @hx

            I apologise that i cant figure it out directly at the moment even though i would like to help :)

            I have found some content online that will definitely get you to your wanted destination! I hope this helps and i haven't let you down!

            https://www.w3schools.com/css/css_align.asp

            https://vanseodesign.com/css/vertical-centering/

            https://css-tricks.com/centering-css-complete-guide/

            https://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/

            https://www.w3docs.com/snippets/css/how-to-vertically-center-text-with-css.html

            https://blog.logrocket.com/13-ways-to-vertical-center/

            Once again good luck! Let me know how you go :)

            Sincerely
            Richard

            H 1 Antwort Letzte Antwort
            0
            • RichardR Richard

              Dear @hx

              I apologise that i cant figure it out directly at the moment even though i would like to help :)

              I have found some content online that will definitely get you to your wanted destination! I hope this helps and i haven't let you down!

              https://www.w3schools.com/css/css_align.asp

              https://vanseodesign.com/css/vertical-centering/

              https://css-tricks.com/centering-css-complete-guide/

              https://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/

              https://www.w3docs.com/snippets/css/how-to-vertically-center-text-with-css.html

              https://blog.logrocket.com/13-ways-to-vertical-center/

              Once again good luck! Let me know how you go :)

              Sincerely
              Richard

              H
              H
              hx
              schrieb am zuletzt editiert von
              #6

              Thank you @Richard-Keith, I'll give these a read - even though I already delved into some of them!

              xx

              1 Antwort Letzte Antwort
              0
              • V vavavavava referenced this topic on

              Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.

              Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.

              Mit deinem Input könnte dieser Beitrag noch besser werden 💗

              Registrieren Anmelden
              Antworten
              • In einem neuen Thema antworten
              Anmelden zum Antworten
              • Älteste zuerst
              • Neuste zuerst
              • Meiste Stimmen


              Online Users
              Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
              laytheme.com
              • Anmelden

              • Du hast noch kein Konto? Registrieren

              • Anmelden oder registrieren, um zu suchen
              • Erster Beitrag
                Letzter Beitrag
              0
              • Aktuell
              • Tags
              • Beliebt
              • Benutzer
              • Suche