I am noob in bootstrap and making one simple responsive web design. I had given the bootstrap container the image now i want to add text over the images, so i can add more text and images on that container. I tried on google but didn't find the exact answer. Please help
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-8 col-centered">
<div class="maintxt">
<img src="background.png" class="img-responsive">
</div>
</div>
</div>
</div>
and here is the image, what i want - http://i.imgur.com/FAPXpFL.jpg
On the Insert tab, in the Text group, click Text Box, drag to draw a text box anywhere near the picture, and then type your text. To change the font or style of the text, highlight the text, right-click it, and then select the text formatting you want on the shortcut menu.
CSS position property is used to set the position of text over an image. This can be done by enclosing the image and text in an HTML “div”. Then make the position of div “relative” and that of text “absolute”.
Image Overlay: Image overlay generally refers to the image being a background image and inserting texts, and links inside of that image. It can be done using the 'card-img-overlay' property that is present in bootstrap. Also, we can do it with normal CSS along with a bootstrap theme.
BootstrapVue's custom b-overlay component is used to visually obscure a particular element or component and its content. It signals to the user of a state change within the element or component and can be used for creating loaders, warnings/alerts, prompts, and more.
I'd be inclined to put the image in place as a background:
.maintxt {
background-image: url(images/background.png);
background-size: cover;
}
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-8 col-centered">
<div class="maintxt">
My great text.
</div>
</div>
</div>
</div>
If that doesn't work, you'll need to use relative and absolute positioning:
.maintxt {position: relative;}
.maintxt > img, .overlay-text {position: absolute;}
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-8 col-centered">
<div class="maintxt">
<img src="background.png" class="img-responsive">
<span class="overlay-text">My super text.</span>
</div>
</div>
</div>
</div>
Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With