Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. How to place text over an image using HTML/CSS?

How to place text over an image using HTML/CSS?

Scheduled Pinned Locked Moved Web Development
htmlcssdesigndockerhelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alex Dunlop
    wrote on last edited by
    #1

    I have pairs of images and their related texts in my web application. My images are small rounded photos that the user can click on each of them to enter a new page. I want to place their specified texts at the center of those thumbnails. I wrote these codes:

        Information System
        #main-image{
                display: block;
                margin-left: auto;
                margin-right: auto;
                max-width: 100%;
                max-height: auto;
            }
            b{
                font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
                color: blue;
            }
            .sub-image{
                border-radius: 5%;
            }
            .container{
                position: relative;
                text-align: center;
            }
    
    
        
    
    
        
    
            ![Intro](Images/IT.jpg)
    

            ![](Images/repair.jpg)
            
    
                **Failures**
            
    
        
    
        
    
            ![](Images/Equipment.jpg)
            
    
                **Equipments**
    

    Please help me.

    M 1 Reply Last reply
    0
    • A Alex Dunlop

      I have pairs of images and their related texts in my web application. My images are small rounded photos that the user can click on each of them to enter a new page. I want to place their specified texts at the center of those thumbnails. I wrote these codes:

          Information System
          #main-image{
                  display: block;
                  margin-left: auto;
                  margin-right: auto;
                  max-width: 100%;
                  max-height: auto;
              }
              b{
                  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
                  color: blue;
              }
              .sub-image{
                  border-radius: 5%;
              }
              .container{
                  position: relative;
                  text-align: center;
              }
      
      
          
      
      
          
      
              ![Intro](Images/IT.jpg)
      

              ![](Images/repair.jpg)
              
      
                  **Failures**
              
      
          
      
          
      
              ![](Images/Equipment.jpg)
              
      
                  **Equipments**
      

      Please help me.

      M Offline
      M Offline
      Member_15298656
      wrote on last edited by
      #2

      Hey you have to write these css code to make text appear over the image and center .

      .image-text{position:absolute; top:50%; left:0; width:100%; z-index:10; text-align:center; transform:translateY(-50%);}

      You can keep you css as it is.. just paste above css and your text will be over and center. let me know if it work for you.

      A 1 Reply Last reply
      0
      • M Member_15298656

        Hey you have to write these css code to make text appear over the image and center .

        .image-text{position:absolute; top:50%; left:0; width:100%; z-index:10; text-align:center; transform:translateY(-50%);}

        You can keep you css as it is.. just paste above css and your text will be over and center. let me know if it work for you.

        A Offline
        A Offline
        Alex Dunlop
        wrote on last edited by
        #3

        Thanks

        M 1 Reply Last reply
        0
        • A Alex Dunlop

          Thanks

          M Offline
          M Offline
          Member_15298656
          wrote on last edited by
          #4

          Welcome :) let me know if any problem, thanks Regards Backlinkyourwebsite

          A 1 Reply Last reply
          0
          • M Member_15298656

            Welcome :) let me know if any problem, thanks Regards Backlinkyourwebsite

            A Offline
            A Offline
            Alex Dunlop
            wrote on last edited by
            #5

            Thanks.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups