How to fill each column with responsive background? Bootstrap - html

I would like each column to have its own background. I would like it to be fixed height as the columns are but so the width can adapt.
This is my html for the 3 blocks.
<section class="no-pad clearfix">
<div class="col-md-4 col-sm-6 no-pad">
<div class="feature-box bg-hfc">
<h1 class="text-white">Hellfire Citadel</h1>
<p class="text-white">Hellfire Assault<br>Iron Reaver<br>Kormrok<br>Kilrogg Deadeye<br>Hellfire High Council<br>Gorefiend<br>Shadow-Lord Iskar<br>Socrethar the Eternal<br>Tyrant Velhari<br>Fel Lord Zakuun<br>Xhul'horac<br>Mannoroth<br>Archimonde<br></p>
</div>
</div>
<div class="col-md-4 col-sm-6 no-pad">
<div class="feature-box bg-brf">
<h1 class="text-white">Blackrock Foundry</h1>
<p class="text-white">Oregorger<br>Gruul<br>The Blast Furnace<br>Hans'gar and Franzok<br>Flamebender Ka\'graz<br>Kromog<br>Beastlord Darmac<br>Operator Thogar<br>The Iron Maidens<br>Blackhand<br><br><br><br>
</p>
</div>
</div>
<div class="col-md-4 col-sm-6 no-pad">
<div class="feature-box bg-hm">
<h1 class="text-white">Highmaul</h1>
<p class="text-white">Kargath Bladefist<br>The Butcher<br>Brackenspore<br>Tectus<br>Twin Ogron<br>Ko'ragh<br>Imperator Mar'gok<br><br><br><br><br><br><br></p>
</div>
</div>
</section>
This is my css, each column is to have its own background:
.bg-hfc{
background-image:url('../img/hfcbg.png') !important;
background-repeat: no-repeat !important;
background-size: contain !important;
background-position: center !important;
}
.bg-brf{
background-image:url('../img/brfbg.png') !important;
background-repeat: no-repeat !important;
background-size: contain !important;
background-position: center !important;
}
.bg-hm{
background-image:url('../img/hmbg.png') !important;
background-repeat: no-repeat !important;
background-size: contain !important;
background-position: center !important;
}
you can find my currently not working demo here: http://endless-guild.com/wow_progress/show-progress.php
This is what I would like it to look like: http://cl.ly/image/1z3I33281R1b
Ignore the guide lines :)
I did lot of digging around but cant figure out what im doing wrong here. I know the code is awful. I am not very good at this and I would appreciate your help. Many love!

you almost had it right: Try this NEW and fixed HTML:
<section class="no-pad clearfix">
<div class="col-md-4 col-sm-6 no-pad">
<div class="feature-box bg-hfc col-xs-12">
<h1 class="text-white">Hellfire Citadel</h1>
<p class="text-white">Hellfire Assault
<br>Iron Reaver
<br>Kormrok
<br>Kilrogg Deadeye
<br>Hellfire High Council
<br>Gorefiend
<br>Shadow-Lord Iskar
<br>Socrethar the Eternal
<br>Tyrant Velhari
<br>Fel Lord Zakuun
<br>Xhul'horac
<br>Mannoroth
<br>Archimonde
<br>
</p>
</div>
</div>
<div class="col-md-4 col-sm-6 no-pad">
<div class="feature-box bg-brf col-xs-12">
<h1 class="text-white">Blackrock Foundry</h1>
<p class="text-white">Oregorger
<br>Gruul
<br>The Blast Furnace
<br>Hans'gar and Franzok
<br>Flamebender Ka\'graz
<br>Kromog
<br>Beastlord Darmac
<br>Operator Thogar
<br>The Iron Maidens
<br>Blackhand
<br>
<br>
<br>
<br>
</p>
</div>
</div>
<div class="col-md-4 col-sm-6 no-pad">
<div class="feature-box bg-hm col-xs-12">
<h1 class="text-white">Highmaul</h1>
<p class="text-white">Kargath Bladefist
<br>The Butcher
<br>Brackenspore
<br>Tectus
<br>Twin Ogron
<br>Ko'ragh
<br>Imperator Mar'gok
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</p>
</div>
</div>
</section>
You where just missing the col-xs-12 on the classes.
EDIT
Try this CSS as well :)
.bg-hfc{
background-image:url('../img/hfcbg.png') !important;
background-repeat: no-repeat !important;
background-size: contain !important;
background-position: center !important;
width: 100%;
height: 100%;
}
.bg-brf{
background-image:url('../img/brfbg.png') !important;
background-repeat: no-repeat !important;
background-size: contain !important;
background-position: center !important;
width: 100%;
height: 100%;
}
.bg-hm{
background-image:url('../img/hmbg.png') !important;
background-repeat: no-repeat !important;
background-size: contain !important;
background-position: center !important;
width: 100%;
height: 100%;
}

This should do the trick:
.bg-hfc{
background-image: url('../img/hfcbg.png');
background-repeat: no-repeat;
background-size: 100% auto;
}
fiddle.

Thank you all for your help.
Turn out 16 hours of coding is bit too much and I was being absolute moron and not even going to say how badly i messed up haha.
Anyway! The css I was after was this:
background-image: url('../img/brfbg.png');
background-repeat: no-repeat;
background-position: center;
background-size: cover;
You can see final result here:
Demo

Related

How to make my background image not going out its div

I'm new. I've created a <div> inside a <section> and in this <div> I've added two background images using Gridlex. For some reasons, both photo go out of the container. I'd like to do something so both pictures don't go out of the container and take all the space of their Gridlex block.
Anyone, would know what I can do to fix this?
Here the photo:
enter image description here
Here the CSS I've wrote for both images:
.bg-about1 {
background-image: url('../images/about1.jpg') ;
background-size: cover;
background-repeat: no-repeat;
min-height: 500px;
}
.bg-about2 {
background-image: url('../images/about2.jpg') ;
background-size: cover;
background-repeat: no-repeat;
min-height: 500px;
}
<section class="light-bg section-about">
<div class="grid">
<div class="col-5_sm12-middle">
<h2 class="padded-7p center uppercase p-white">Title.</h2>
</div>
<div class="col-7_sm12-middle bg-about1">
<!-- <img class="img100" src="./images/about1.jpg" alt="Art design"> -->
</div>
<div class="col-5_sm12-middle bg-about2">
<!-- <img class="img100" src="./images/about2.jpg" alt="photo"> -->
</div>
<div class="col-7_sm12-middle">
<p class="padded-2 p-white"> my text.</p>
</div>
</div>
</section>
maybe try instead of
background-size: cover;
writing:
background-size: contain;

How to make the background visible?

I have a simple code for a simple webpage, but it does not work: for some reason, the background is not displayed. I checked everything in different browsers on different computers. Where do you think there might be a mistake?
.section--map {
padding: 40px 0;
background: #e6e6e6 url("../images/map-bg.jpg") center no-repeat;
-webkit-background-size: cover;
background-size: cover;
}
<section class="section section--map">
<div class="container">
<div class="map">
<div class="map__title">
<div><i class="fas fa-map-marker-alt"></i></div>
<h2>Open Map</h2>
</div>
</div>
</div>
</section>
Did you check if path to your image is correct or it might be that your image type is .jpeg?

Why the width of grid system is more greater than body?

First of all, my native language is not English I hope that question and description are clear. I'm sorry if they're not.
Problem:
I'm using MDB framework, when I use the grid system the width of the last column is more greater than body. I tried to put widht: 100%; in the content and in every column (Class: Nx).
How do I fix this?
Html:
<div class="Mycolumns">
<div class="row">
<div class="col-8 N1" style="background-image: url(Resources/img/1.jpg); background-repeat: no-repeat; background-size: cover;">
</div>
<div class="col-4 N2" style="background-image: url(Resources/img/Sin%20t%C3%ADtulo-1.jpg); background-repeat: no-repeat; background-size: cover;">
</div>
<div class="col-4 N3" style="background-image: url(Resources/img/3.jpg); background-repeat: no-repeat; background-size: cover;">
</div>
<div class="col-4 N4" style="background-image: url(Resources/img/4.jpg); background-repeat: no-repeat; background-size: cover;">
</div>
<div class="col-4 N5" style="background-image: url(Resources/img/5.jpg); background-repeat: no-repeat; background-size: cover;">
</div>
</div>
</div>
Css:
.N1, .N2{
height: 500px;
}
.N3, .N4, N5{
height: 300px;
}
I just encountered the same problem. What was doing it was one of my nested elements was set to width: 100vw - The view width seems to be the entire browser window including the scrollbar, so you effectively get '100% + scrollbar width' as your width, which gave me a 15px or so blowout. Changing the element's width to 100% fixed it.

how to show the complete background image in a jumbotron?

so I realized if I have more content it shows the complete background image. Is there a neat way to do this?
<div class="jumbotron jumbotron-fluid" style="background: url('./assets/img/mhacks.jpg') no-repeat center center; margin-top: 120px;">
<div class="container text-sm-center p-t-3">
<br>
<br>
<br>
<br>
<p class="lead">Under construction</p>
<br>
<br>
<br>
</div>
</div>
I would experiment with using the contain or cover value for the background-size property:
.jumbotron.test {
background: url(http://www.outdoor-photos.com/_photo/4488849.jpg) no-repeat;
background-size: cover; /*** Try interchanging with contain/cover when using media queries for different results at different viewports. ***/
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<div class="jumbotron jumbotron-fluid test">
<div class="container text-sm-center p-t-3">
<br>
<br>
<br>
<br>
<p class="lead">Under construction</p>
<br>
<br>
<br>
</div>
</div>
background: bg-color bg-image position/bg-size bg-repeat; //shorthand
div{
background: #333 url('../img-url.jpg') no-repeat center center;
background-size: cover;
}
Change your html as below:
<div class="jumbotron jumbotron-fluid" style="background: url('variable-scope-ruby.jpg') no-repeat center center; margin-top: 120px;">
<div class="container text-sm-center p-y-3">
<p class="lead">Under construction</p>
</div>
</div>
also add below css style:
<style>
.lead{
padding: 30px 0px;
text-align:center;
}
</style>
and update .lead padding as your requirement.

Responsive CSS Sprites in Bootstrap

I have a sprite image that I want to use. I can get everything working the way I want on desktop size monitor, but on smaller screen sizes, things go bad and the sprites do not respond.
Here is a codepen of what I currently have.
I tried playing about with:
background-size: options
background-clip: options
But still couldn't get it to work. My HTML is:
<div class="row">
<div class="col-md-2 orange">
<div class="img-wrap"></div>
<h2>item-01</h2>
</div>
<div class="col-md-2 blue">
<div class="img-wrap"></div>
<h2>item-02</h2>
</div>
<div class="col-md-2 orange">
<div class="img-wrap"></div>
<h2>item-03</h2>
</div>
<div class="col-md-2 blue">
<div class="img-wrap"></div>
<h2>item-04</h2>
</div>
<div class="col-md-2 orange">
<div class="img-wrap"></div>
<h2>item-05</h2>
</div>
<div class="col-md-2 blue">
<div class="img-wrap"></div>
<h2>item-06</h2>
</div>
</div>
And the CSS is:
.img-wrap {
width: 100%;
height: 145px;
margin: 0 auto;
background-image: url('http://oi57.tinypic.com/15qtcv7.jpg');
background-repeat: no-repeat;
background-color: transparent;
}
.orange .img-wrap {
background-position: 0px 0px;
}
.blue .img-wrap {
background-position: -155px 0px;
}
.col-md-2 h2 {
text-align: center;
}
Is there a way I can make sprite responsive? I tried Google, but nothing I found did it for me