i’m sure this is pretty simple, but i wasn’t able to find a good source for how to put text over an image. I changed the texts z index, but it’s still just sitting above an image element. Is there something else I need to do to make this work?
Great question! Add % padding (top and bottom) to the div that holds the text, not the image div. If you want the text to be exactly center then the exact % will depend on how much text you have. This technique will make sure the text stays centered even if the image is responsive.
Thanks! However, the issue with the first solution in regards to the setting the div image bg is that if i want to do this for many components, for example in a table, changing one of those div’s bg changes all of them (since they are part of the same style). Does that mean i need to create a different style for each of those divs?
Any common attributes can be set in one class, then you can use nested class to add background images. This way when you change to setting of the top level class it will change for all elements with that class, without effecting what ever is set in the sub class.
@Davidn is absolutely correct. @royherma, in general, you have to give each element in your design a different class if you want to affect styles differently for each element.
Sorry to bump this old thread but it Is there a way to do this with images in a dynamic list rather than using a background image in a div? Thanks a lot