I am using bootstrap frame work and using the jumbotron feature to create my header. I have a fixed navigation and want the jumbotron to be the full height and width of screen when scaled. I have content underneath the jumbotron that I want scrollable like regular. Just when someone gets to site its fullscreen jumbotron
html
<div class="jumbotron row">
<header>
<div class='navbar ........
... paragraph content ...
</div>
css
.jumbotron {
position: relative;
background: url('../img/pexels-photo.jpeg') no-repeat center center;
background-size: cover;
height:100%;
}
purii's answer is perfectly acceptable, however I'd opt for a slightly different approach when targeting the jumbotron BootStrap class:
HTML:
<div class="fullheight jumbotron row">
<header>
<div class='navbar ........
... paragraph content ...
</div>
CSS:
.fullheight.jumbotron {
position: relative;
background: url('../img/pexels-photo.jpeg') no-repeat center center;
background-size: cover;
min-height:100vh;
}
As you can see I placed a new fullheight class (can be any class name of course) within the "jumobtron" <div>. I then used that class name along with the jumbotron class as the selector for CSS styling.
The benefits of doing it this way is that it ensures that if you chose to use <div class="jumobtron"> on another page in the future, you can still use BootStrap's default styling for this class.
There are multiple ways to solve your problem. The most straight forward would be the usage of viewport units to scale your height. They are supported at least by IE >= 9.
.jumbotron {
position: relative;
background: url('../img/pexels-photo.jpeg') no-repeat center center;
background-size: cover;
min-height:100vh;
}
Related
I am trying to create a grid layout in conjunction with parallax. I have a div element (in Parallax below) which has a grid layout defined in CSS, containing three sub div elements. The second div has a background style applied to it, but the style is being applied across all divs.
I am basically trying to have a white box displayed in the middle of the page, which scrolls with the help of parallax, while currently I have a white stripe displayed across the entire page.
Is this feasible?
.parallax {
background-image: url('image.jpg');
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.inParallax {
display: grid;
grid-template-columns: auto auto auto;
}
<div class="parallax"></div>
<div class="inParallax">
<div></div>
<div style="height:200px;background-color:white;">
<p>Text</p>
</div>
<div></div>
</div>
New at Bootstrap. I'm having a problem setting my background image to follow the header image.
The header section has it's own full-screen background, which I then want to be followed by a tiled background image.
I tried:
<div class="header">...</div>
<div class="main-body">
<div class="container">...</div>
<div class="container">...</div>
...
</div>
<div class="footer">...</div>
with the following stylesheet:
.main-body {
text-align: center;
background: url(../img/setttings-bg-black.jpg) no-repeat center center;
background-size: 1024;
background-color: #000000;
}
.header {
text-align: center;
color: #000000;
background: url(../img/promo-bg.jpg) no-repeat center center;
background-size: cover;
}
The problem is that the main-body background's top is hidden by the bottom part of the header body.
What am I doing wrong?
Verify this link or link
have a solution for you.
problem 1)
What I did is I added a <img> below the first div (so the div with the class intro). The img has a clas of bg.
Than add this css:
.bg{
position:absolute;
z-index:-1;
width:100%;
height:100%;
}
here you have a working fiddle. I added a lot of <br> tags to show you it works.
You can also try to set the background image height:100% and width:auto;. If you do this the image won't be so crammed together on some screens.
problem 2)
I Gave every slide a class slide1. I also added to all the slide classes position:relative;. Taka a look at this fiddle.
i hope your question is now anwsered. If you have other problems, feel free to ask.
I want to add a parallax scrolling effect to the .intro-body of my home-page in the same way that I have added this effect to the jumbotron images I have on my 'About', 'Resume' and 'Portfolio' pages. For some reason however the background image doesn't show when I apply it to the .bg class. The images show correctly on the other pages; the only difference is that I'm using #intro before .bg which I have done so that I can style this image to fit the entire height and width of the screen.
The background: CSS property is showing an image in the below fiddle, but I can't get it to work on my own website:
https://jsfiddle.net/c3do6hj0/
Is there something I'm doing wrong here? I've spent about 3 hours researching on SO but to no avail, so any ideas are much appreciated, thanks
My homepage
HTML
<header class="intro" id="intro">
<div class="bg"></div>
<div class="intro-body">
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1 class="brand-heading">Jon Howlett</h1>
<p class="intro-text">Aspiring web designer<br/>&<br/>front-end developer</p>
<a href="#summary" class="btn btn-circle page-scroll">
<i class="fa fa-angle-double-down animate"> </i><span class="zero">Button Down</span>
</a>
</div>
</div>
</div>
</div>
</header>
CSS
#intro .bg {
background: url("https://upload.wikimedia.org/wikipedia/common/5/57/LA_Skyline_Mountains2.jpg") no-repeat scroll center bottom / cover;
background-size: cover!important;
position: fixed;
width: 100%;
height: 1000px;
top:0;
left:0;
z-index: -1;
}
.intro-body {
width: 100%;
height: auto;
padding: 100px 0px;
text-align: center;
color: #FFF;
background: transparent;
}
You have an inline style on the .bg div: height:0px;.
If i add the background: #000 url("images/intropage_mountains.jpg") no-repeat scroll center bottom / cover; to the .bg div then disable the inline style the background image shows up.
It appears that something in one of your javascript files is applying this inline-style.
When i change the class to something else such as bg_main the inline-style goes away and the background image works.
EDIT*: As a side note. I noticed that you have 2 different versions of jquery resourced.
http://code.jquery.com/jquery-2.1.4.min.js
and
http://www.jonhowlett.uk/js/jquery.js
I would advise you to only keep the latest version. having more than one jquery resource can sometimes cause conflicts with your code.
Currently I'm working on a website for a restaurant / hotel / vineyard. There are supposed to be 3 separate websites that I want to connect on one intro page.
I want to create an intro page which fills the full screen, 3 columns side by side, and each column with full height filled with a picture regarding to each site I want to link.
I started to go about it like this:
Bootstrap Columns:
<div class="row intro-div no-gutters">
<div class="col-md-4 fill-res"></div>
<div class="col-md-4 fill-wein"></div>
<div class="col-md-4 fill-hotel"></div>
</div>
CSS:
.fill-hotel{
height:100%;
min-height:100%;
background-image: url('../images/intro-hotel.jpg');
background-repeat: no-repeat;
background-position: top center;
background-color: #000000;
}
It looks great on my screen and when I change the size of my browser it's responsive, but it changes the section of the picture. For example, if there were a head in the picture, when I use a larger screen, then the head would be cropped on a small screen.
Any suggestions?
This is an optimized version of the CSS used by #Alvaro Menendez to avoid repeating properties for similar elements.
Note: there is also a slight change of background-position: top center; -> hopefully that should do it.
HTML
<div class="row intro-div no-gutters">
<div class="col-md-4 fill fill-res"></div>
<div class="col-md-4 fill fill-wein"></div>
<div class="col-md-4 fill fill-hotel"></div>
</div>
CSS
html, body, div {height:100%;}
.col-md-4 {
float:left;
width:33.333333333%;
background-size:cover;
}
.fill{
height:100%;
min-height:100%;
background-repeat: no-repeat;
background-position: top center;
background-color: #000000;
}
.fill-hotel{
background-image: url('http://upload.wikimedia.org/wikipedia/commons/2/28/Monarch_Butterfly_Danaus_plexippus_Vertical_Caterpillar_2000px.jpg');
}
.fill-res {
background-image: url('http://upload.wikimedia.org/wikipedia/commons/0/07/Soyuz_TMA-02M_spacecraft_in_a_vertical_position.jpg');
}
.fill-wein {
background-image: url('http://upload.wikimedia.org/wikipedia/commons/1/10/F-14A_VF-24_Vertical_Climb.JPEG');
}
Updated fiddle demo
as an excercise i decided to delve in to css layout styling and am already failing to see why my layout is not aligning correctly. also why is the container div only appearing when there some text in there. i thought it would display and grow based on the background property in css statement. i have done screengrab to show problem. can someone show my error. thanks
screen grab: http://imageshack.us/photo/my-images/21/containergrabnew.png/
css
#container {
width: 800px;
margin: 0 auto;
background-image: url(../images/container-bg.gif);
background-position: center center;
background-repeat: repeat-y;
}
#containerLeft {
width: 475px;
float:left;
background-image: url(../images/container-left-bg.gif);
background-position: center center;
background-repeat: repeat-y;
}
#containerRight {
width: 300px;
float:right;
background-image: url(../images/container-right-bg.gif);
background-position: center center;
background-repeat: repeat-y;
}
html
<div id="container">
This is the container
<div id="containerLeft">
This is the left container
<div id="containerRight">
This is the right container
</div></div>
</div>
am already failing to see why my
layout is not aligning correctly
Your HTML is not nested correctly. Change it to this:
<div id="container">
<div id="containerLeft">
This is the left container
</div>
<div id="containerRight">
This is the right container
</div>
</div>
also why is the container div only
appearing when there some text in
there. i thought it would display and
grow based on the background property
in css statement.
You need to clear your floated elements.
You can do this by adding overflow: hidden to #container.
You should read this article for more information: http://css-tricks.com/all-about-floats/
It discusses why this happens, various ways to fix it, and includes useful and relevant information about floats in general.