Height:100% not working for my image - html

I know its been asked a million times but none of the search results seemed to work for me.
I am wondering how i can make my image to the same size as the display. I know i have to give the parent of the image a height and width so that i can use Height:100% but how can i give its parent a height and width that is different for every device?
I used position:absolute but that just made all the other content sit on top of my picture :(
am using bootstrap as well (encase you need that info)
any help would be boss! thanks!
A lil bit of my markup
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server" >
**this img below to be the size of users display**
<div style="background-color:#efefef; background-image: url(/App_Themes/Biz/Images/home-main.jpg); position: static; height:100%; width:100%; background-position:center bottom; background-repeat:no-repeat; background-size:cover;">
<div class="container" style="height:1200px;">
<div class="jumbotron" style="color:#fff; background-color:transparent; text-align:center;">
<h2 style="font-weight:bold!important;">FREE rents</h2>
<p>The easy way to rent out stuff</p>
<p><a class="btn btn-default" role="button" href="#moreInfoPanel" id="findOutMore">FIND OUT MORE</a> <a class="btn btn-primary" href="/Account/Add-Property" role="button">rent it now</a></p>
</div>
</div>
</div>
<div style="background-color:#eff5f7; border-top:solid 1px #e6e9ea; border-bottom:solid 1px #e6e9ea;">
<div class="container">
<img src="App_Themes/biz/Images/sign.png" alt=" Portals" style="padding:5% 0%; width:100%;" />
</div>
</div>
<div>
<div class="container" id="moreInfoPanel">
<div class="row">
<div class="col-xs-12 col-sm-4 col-md-4" style="margin:60px 0px 40px 0px">
<div style="text-align:center; padding:10px 30px; border:solid 1px #e7ecef; border-bottom:solid 5px #e7ecef;">
<img src="App_Themes/biz/Images/free.png" style="margin-top:-55px;" alt="Lets Rent - FREE" />
<h4>Free</h4>
<p>
some stuff
</p>
<a href="Pricing" title="Read More - Pricing" class="btn btn-primary" style="margin-bottom:-40px;" >read more</a>
</div>
</div>
<div class="col-xs-12 col-sm-4 col-md-4" style="margin:60px 0px 40px 0px">
<div style="text-align:center; padding:10px 30px; border:solid 1px #e7ecef; border-bottom:solid 5px #e7ecef;">
<img src="App_Themes/biz/Images/quick.png" id="quickImage" runat="server" style="margin-top:-55px;" alt="QUICK" />
<h4>Quick</h4>
<p>
more crap
</p>
<a href="Benefits" title="Read More - Benefits" class="btn btn-primary" style="margin-bottom:-40px;" >read more</a>
</div>
</div>
<div class="col-xs-12 col-sm-4 col-md-4" style="margin:60px 0px 40px 0px">
<div style="text-align:center; padding:10px 30px; border:solid 1px #e7ecef; border-bottom:solid 5px #e7ecef;">
<img src="App_Themes/biz/Images/easy.png" style="margin-top:-55px;" alt="EASY" />
<h4>Easy</h4>
<p>
boom stuff here!
</p>
<a href="Benefits" title="Read More - Benefits" class="btn btn-primary" style="margin-bottom:-40px;" >read more</a>
</div>
</div>
</div>
</div>

One easy and fast way to do this is use vh-units. Check that you have proper browser support in http://caniuse.com/#feat=viewport-units
css:
.full-img{
height:100vh; /* This means 100 percent of viewport height */
background:red;
}
html:
Above the full height block
<div class="full-img">
<p>This takes 100% of viewport height = 100vh</p>
<p>check http://caniuse.com/#feat=viewport-units for browser support</p>
</div>
Below the full height block

Related

Bootstrap Mobile Vertical Spacing

I'm using Twitter's Bootstrap to design a website but i'm finding problems to control the vertical spacing of the website on mobile view because the elements are either sticking or too far apart when switched to mobile view.
is there anything that boostrap offers to increase or decrease the spacing, such as col-xx-offset-# for the horizontal gapping?
Or is there any other standard method to control this?
Code Example with inline style:
https://jsfiddle.net/6e513k5o/
<div class="container">
<div>
<div style="color: #555;border: 3px solid #ed008c;border-radius: 4px; padding:10px" class="col-md-offset-2 col-md-3">
<img class="img-responsive" style="margin:auto" src="http://placehold.it/231x213">
</div>
<div style="color: #555;border: 3px solid #ed008c;border-radius: 4px; padding:10px;margin-top:100px;margin-left:-3px;" class="col-md-3">
<div style="text-align:center">
<label>
Mr. John Doe
</label>
<br>
<p>
CEO
</p>
</div>
</div>
</div>
</div>
use <div class="row"> after <div class="container">
The good thing about bootstrap is that you can customize it as per your need.
Please add a custom margin for columns. Please find the updated fiddle.
https://jsfiddle.net/6e513k5o/6/
HTML
<div class="container">
<div class="row">
<div class="col-md-offset-2 col-md-3 custom-class">
<img class="img-responsive" style="margin:auto" src="http://placehold.it/231x213">
</div>
<div class="col-md-3 custom-class">
<div style="text-align:center">
<label>
Mr. John Doe
</label>
<br>
<p>
CEO
</p>
</div>
</div>
</div>
</div>
CSS
.custom-class {
color: #555;
border: 3px solid #ed008c;
border-radius: 4px;
padding: 10px;
margin-bottom: 10px;
}

How to align text in line with icons?

http://jsfiddle.net/acz3hhsL/
Code:HTML
<div id="contact-info">
<div id="adresa">
<div id="addPadding" style="padding: 2em;">
<img src="http://avocat.dac-proiect.ro/wp/wp-content/themes/twentyfourteen/images/ADRESA.png" style="width:22px;height:31px;float:left;display: inline;">
<div style="float: right;display: inline;width: 80%;">
<p style="text-align:left;font-size:14px;color:black;">Calea Dorobantilor,nr.74,<br>bl.Y9,SC.2,Ap.25<br>Cluj-Napoca,400609<br>Romania</p>
</div>
</div>
</div>
<div id="telefon">
<div id="addPadding" style="padding: 60px 2em;">
<img src="http://avocat.dac-proiect.ro/wp/wp-content/themes/twentyfourteen/images/TELEFON.png" style="width:22px;height:31px;float:left;display: inline;">
<div style="float: right;display: inline;width: 80%;">
<p style="font-size:14px;color:black;text-align:left;">Tel./Fax (004) 0264 448 579<br>Tel.(004) 0744 490 776</p>
</div>
</div>
</div>
<div id="mail">
<div id="addPadding" style="padding: 20px 2em;">
<img src="http://avocat.dac-proiect.ro/wp/wp-content/themes/twentyfourteen/images/E-MAIL.png" style="width:26px;height:19px;float:left;display: inline;">
<div style="float: right;display: inline;width: 80%;">
<p style="font-size:14px;color:black;text-align:left;">office#codoban.com</p>
</div>
</div>
</div>
</div>
</div>
Code CSS:
#contact-info
{
width:268px;
height:270px;
background:url(http://avocat.dac-proiect.ro/wp/wp-content/themes/twentyfourteen/images/BODY-CONTACT.png);
position:absolute;
right:0;
}
This is the site:
http://avocat.dac-proiect.ro/wp
I changed the text font size and unfortunately not displayed inline with icon sites.
How can I get him back but font-size:14px;
Can you help me please to solve this problem?
Thanks in advance!
Add
p {margin: 0;}
to your CSS, that removes the gaps/offset of the text. http://jsfiddle.net/acz3hhsL/2/

Margin between my boxes CSS

I have those 3 boxes
and I want to have some margin inbetween them. As soon as I add margin, the 3rd one goes to the next row. Here's the code:
CSS:
#hotels {
background: url('../img/PICS/19427110_ml.jpg');
background-size: 100%;
height:10px;
color:whitesmoke;
}
.contenhotelsclass {
border-radius:10px;
padding: 70px;
height: 700px;
background: rgba(0, 0, 13, 0.6);
}
.contentsfirst {
padding-top: 100px;
padding-bottom: 100px;
}
If I add
.marginyes {
margin: 0 30px;
}
The next row thing happens.
HTML:
<section id="hotels">
<div class="row">
<div class="col-md-12 contentsfirst" id="contenthotels">
<div class="col-md-4 contenhotelsclass">
<img src="{{ URL::asset('img/PICS/18911510_ml.jpg') }}" class="img-circle img-responsive"> </img>
<span><h2>{{ Str::upper($wording['training']->container) }}</h2></span>
<span style="padding-top: 100px">{{ Str::limit($wording['training']->wording , 400, '...') }}</span>
<span ><p style="padding-top: 30px;"><button id="trainbutton" class="btn btn-success">Read more!</button></p></span>
</div>
<div class="col-md-4 contenhotelsclass marginyes">
<img src="{{ URL::asset('img/PICS/20360155_m.jpg') }}" class="img-circle img-responsive"> </img>
<span><h2>{{ Str::upper($wording['taste']->container) }}</h2></span>
<span style="padding-top: 100px">{{ Str::limit($wording['taste']->wording ,400,'...') }}</span>
<span><p style="padding-top: 30px;"><button id="eatbutton" class="btn btn-success">Read more!</button></p></span>
</div>
<div class="col-md-4 contenhotelsclass">
<img src="{{ URL::asset('img/PICS/31786072_ml.jpg') }}" class="img-circle img-responsive"> </img>
<span><h2>{{ Str::upper($wording['relax']->container) }}</h2></span>
<span style="padding-top: 100px">{{ Str::limit($wording['relax']->wording ,400,'...') }}</span>
<span><p style="padding-top: 30px;"><button id="relaxbutton" class="btn btn-success">Read more!</button></p></span>
</div>
</div>
</div>
</section>
I'm using bootstrap 3.
How could I solve this?
there is a solution.
change your DOM
old:
<div class="col-md-4 contenhotelsclass">
........
</div>
new:
<div class="col-md-4">
<div class="contenhotelsclass">
.....
</div>
</div>
add following css:
.contenhotelsclass {margin:0px 10px;}
jsFiddle http://jsfiddle.net/mp9napL3/1/
Firstly, I don't understand why you use margin: 0 30px;, I usually use just margin:30px;.
Secondly, the answer is that you have so much spacing between your boxes, your browser just puts the last box on the next line. Use a wider browser and your 3rd box won't go on the next line.
It is obvious, you are using col-md-4 means 25% of parent and when you set extra margin your div covers greater than 25%, the only way is to override col-md-4 class and reduce width from 25% to less.

How do I center wells in bootstrap?

I am working on a simple homepage for my website but I want to get the well evenly spread out. I can align the left to the left and the right to the right but I cant seem to be able to get that middle well to always stay in the centre of the page. I have tried many things but they all don't work, have a look at my site to see what I want to do, the wells are under the image slider. This is the code I have done but and the CSS is the default bootstrap min css with a few tweaks for the colors.
<div class="container">
<div class="row">
<div class="col-lg-4 well" style="margin-left: 10px !important; width: 330px;
margin-right: 10px; padding: 4px !important; min-height: 330px; ">
<center>
<img style="height: 135px;" src="img/ts.png" />
<h3>TeamSpeak 3</h3>
<br />
<p>Chat with us on our TeamSpeak at: <br />
<b>ts.clustermc.net</b>
<br /> So, come have a wonderful conversation with us!</p>
</center>
</div>
<div class="col-lg-4 well" style="margin-left: 10px !important; width: 330px;
margin-right: 10px; padding: 4px !important; min-height: 330px; ">
<center>
<img style="height: 135px;" src="img/wool.png" />
<h3>Cluster MC</h3>
<div class="progress" style="margin-bottom: 7px; width: 200px;">
<div class="progress-bar progress-bar-success" style="width: 2.0%;">
</div>
<div class="progress-bar progress-bar-danger" style="width: 98.0%;">
</div>
</div>
<p style="margin-top: -27px; color: white; font-weight: bold;">
3 Online</p>
<br />
<p>Start collecting your ClusterCredits now at:<br />
<b>play.clustermc.net</b></p>
</center>
</div>
<div class="col-lg-4 well" style="margin-left: 10px !important; width: 330px;
margin-right: 10px; padding: 4px !important; min-height: 330px; ">
<center>
<img style="height: 135px;" src="img/forums.png" />
<h3>Community Forums</h3>
<br />
<p>Come and talk to some of our memers and staff at the forums! <br />
<b>www.clustermc.net/forums
</b>
<br />We dont bite, we promise!</p>
</center>
</div>
</div>
</div>
Sorry for the bad layout, im a beginner to coding and I want to learn :)
This is the Updated code.I have nested a div with class well as it was getting overlapped when used with col-lg-4. Please check the below code:
<div class="container">
<div class="row">
<div class="col-lg-4">
<div class="well" style="height: 330px; width: 330px;">
<center>
<img style="height: 135px;" src="img/ts.png"/>
<h3>TeamSpeak 3</h3>
<br/>
<p>Chat with us on our TeamSpeak at: <br/>
<b><a href="ts3server://ts.clustermc.net">
ts.clustermc.net</a></b>
<br/>
So, come have a wonderful conversation with us!
</p>
</center>
</div>
</div>
<div class="col-lg-4">
<div class="well" style="height: 330px; width: 330px;">
<center>
<img style="height: 135px;" src="img/wool.png"/>
<h3>Cluster MC</h3>
<div class="progress" style="margin-bottom: 7px; width: 200px;">
<div class="progress-bar progress-bar-success"
style="width: 2.0%;"></div>
<div class="progress-bar progress-bar-danger"
style="width: 98.0%;"></div>
</div>
<p style="margin-top: -27px; color: white; font-weight: bold;">
3 Online
</p>
<br/>
<p>Start collecting your ClusterCredits now at:<br/>
<b>play.clustermc.net</b></p>
</center>
</div>
</div>
<div class="col-lg-4">
<div class="well" style="height: 330px; width: 330px;">
<center>
<img style="height: 135px;" src="img/forums.png"/>
<h3>Community Forums</h3>
<br/>
<p>Come and talk to some of our memers and staff at the forums
<br/>
<b><a href="http://clustermc.net/forums">
www.clustermc.net/forums</a>
</b><br/>
We dont bite, we promise!</p>
</center>
</div>
</div>
</div>
</div>
It looks like your three 'well' divs are sitting in the middle of the page already?
As every thing is sitting in <div class="container"> that is the bootstrap class used to center things on a page. As per http://getbootstrap.com/2.3.2/scaffolding.html#layouts.
Note: It looks like you're missing a final ending </div> for the container class
I'm not 100% sure what issue you are having. Maybe provide a screenshot of what you want to achieve?

Responsive slider buttons

Im trying to position some buttons below a slider and I can do so, but the entire site is responsive (botstrap) except for these buttons. So I'm trying to make them so.
I have been trying to work with percents to position them and create fluid heights and widths, but I have had no luck. All I can seem to do is position them on top of one another.
My html looks like this
<div class="col-md-12 sliderBar">
<img src="assets/img/aboutPage.png" alt="" />
</div><!--.col-md-12-->
<div class="col-md-12 sliderNav">
<div class="container">
<button> < </button>
<button>Sponges</button>
<button>DBM</button>
<button>Synthetics</button>
<button> > </button>
</div><!--.container-->
</div><!--.col-md-12-->
and my css looks like this
.sliderNav{
background-color: #1b1a29;
text-align: center;
position:relative;
padding-bottom:3%;
height:0;
overflow:hidden;
}
.sliderNav button{
position:absolute;
width:20%;
height:100%;
}
Any help would be great! I have a fiddle set up here.
this what you want? fiddle
the changes i made are position to relative for button, set button width 15%.. let me know if works :)
here is the code i modified:
.container button{
position:relative;
width:15%;
height:100%;
}
Try this (no additional css needed):
<div class="container">
<div class="col-md-12 sliderBar">
<img src="http://upload.wikimedia.org/wikipedia/commons/4/41/Blank_Earth_Banner.jpg" alt="" class="img-responsive" />
</div><!--.col-md-12-->
<div class="col-md-12">
<div class="btn-group btn-group-justified">
<a class="btn btn-default"> < </a>
<a class="btn btn-default">Sponges</a>
<a class="btn btn-default">DBM</a>
<a class="btn btn-default">SYNTECHICS</a>
<a class="btn btn-default"> > </a>
</div>
</div>
</div>