I would like to get my header to take up the whole screen. I have tried
header {
height: 100%
}
but that didn't change anything. I can get it to work but only by changing the amount of pixels and when I go onto a different computer it doesn't work.
Thank you anyone that can help me, if you need any more information please ask, I will be happy to provide it.
Here you go: HTML
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top">Webfolio</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a class="page-scroll" href="#page-top">Home</a>
</li>
<li>
<a class="page-scroll" href="#accessibility">Accessiblity</a>
</li>
<li>
<a class="page-scroll" href="#usability">Usability</a>
</li>
<li>
<a class="page-scroll" href="#graphics">Graphics</a>
</li>
<li>
<a class="page-scroll" href="#javascript">JavaScript</a>
</li>
<li>
<a class="page-scroll" href="#tools">Tools</a>
</li>
<li>
<a class="page-scroll" href="#videos">Videos</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!-- Header -->
<header>
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">My name is Ian Geer</div>
<div class="email">iandavidgeer#gmail.com</div>
<div class="intro-heading">Web Design:Ingraham 2016</div>
Main Content
</div>
</div>
</header>
and: CSS
header {
padding: 62px 63px;
text-align: center;
color: #fff;
background-attachment: scroll;
background-image: url(../img/seattle.jpg);
background-position: center center;
background-repeat: none;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
Easy solution:
header {
height: 100vh;
}
This uses viewport units. Depending on the browsers that you are supporting, this is probably your best option. Browser support for viewport units
If you need to support IE8 or older mobile browsers, you can do this instead:
html, body {
height: 100%;
}
header {
height: inherit;
}
Related
I'm stuck with this. I want to remove the space between navbar brand and navbar menu. Also when i put navbar logo image, the navbar-fixed will grow bigger and it will cover my page header.
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="logo"><img width="40%" src="images/windsor-logo_horizontal-colored.png" alt="WindSor"></span>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-right">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li>
<a class="page-scroll" href="#page-top"> <span class="glyphicon glyphicon-home"> Home</span></a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
screenshot
the circle space is what i want to remove.
here is my CSS :
body {
width: 100%;
height: 100%;
}
html {
width: 100%;
height: 100%;
}
#media(min-width:767px) {
.navbar {
padding: 20px 0;
-webkit-transition: background .5s ease-in-out,padding .5s ease-in-out;
-moz-transition: background .5s ease-in-out,padding .5s ease-in-out;
transition: background .5s ease-in-out,padding .5s ease-in-out;
margin:
}
.top-nav-collapse {
padding: 0;
}
}
.intro-section {
height: 100%;
padding-top: 150px;
text-align: center;
background: #fff;
}
.about-section {
height: 100%;
padding-top: 150px;
text-align: center;
background: #eee;
}
.services-section {
height: 100%;
padding-top: 150px;
text-align: center;
background: #fff;
}
.contact-section {
height: 100%;
padding-top: 150px;
text-align: center;
background: #eee;
}
You should probably add the class .navbar-brand to the
<span class="logo"><img width="40%" src="images/windsor-logo_horizontal-colored.png" alt="WindSor"></span>
check the jsFiddle : https://plnkr.co/edit/uquYGOtMFu2cNbbwQQFT?p=preview
I guess you are facing the problem with your stylesheet. Using only bootstrap everything is working fine. View the fiddle in full page. you will find the correct output.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="logo"><img width="40%" src="https://assets.servedby-buysellads.com/p/manage/asset/id/28536" alt="WindSor"></span>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-right">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li>
<a class="page-scroll" href="#page-top"> <span class="glyphicon glyphicon-home"> Home</span></a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
I am trying to create a full container image that is centered nicely on all screens.
<body>
<!-- Preloader -->
<div class="page-loader">
<div class="loader">Loading...</div>
</div>
<!-- Navigation start -->
<nav class="navbar navbar-custom navbar-transparent navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#custom-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
<img src="assets/images/kerriwalshjenningswhite.png" alt="Kerri Walsh">
</a>
</div>
<div class="collapse navbar-collapse" id="custom-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
Home
</li>
<li class="dropdown">
Gallery
</li>
<li class="dropdown">
Sponsors
</li>
<li class="dropdown">
Bio
</li>
<li class="dropdown">
Contact
</li>
</div>
</div>
</nav>
<!-- Navigation end -->
<!-- Home start -->
<section id="home" class="home-section home-parallax home-fade kenburns home-full-height">
<div class="hero-slider">
<ul class="slides">
<li class="bg-light-30">
<div class="img">
<img src="assets/images/kerribig4.jpg" />
</div>
<div class="hs-caption">
<div class="caption-content">
<p class="hs-title-size-1 font-serif mb-30">
Hello & welcome
</p>
<h1 class="hs-title-size-5 font-alt mb-40">
I am Kerri Walsh
</h1>
Learn More
</div>
</div>
</li>
<li class="bg-light">
<div class="img">
<img src="assets/images/kerribig3.jpg" />
</div>
<div class="hs-caption">
<div class="caption-content">
<p class="hs-title-size-1 font-serif mb-30">
I am
</p>
<h1 class="hs-title-size-5 font-alt mb-40">
A Mother
</h1>
Learn More
</div>
</div>
</li>
<li class="bg-light">
<div class="img">
<img src="assets/images/kerribig2.jpg" />
</div>
<div class="hs-caption">
<div class="caption-content">
<p class="hs-title-size-1 font-serif mb-30">
I am
</p>
<h1 class="hs-title-size-5 font-alt mb-40">
An Olympian
</h1>
Learn More
</div>
</div>
</li>
</ul>
</div>
</section >
<!-- Home end -->
And then here is the first part of my style.css. I need to make this image appear a in the center of the screen on mobile so you can actually see Kerri Walsh
html {
overflow-y: scroll;
overflow-x: hidden;
-ms-overflow-style: scrollbar;
}
body {
background: #fff;
font: 400 13px/1.8 "Lato", sans-serif;
color: #666;
-webkit-font-smoothing: antialiased;
}
img {
/*width: 100%; */
height: 100%;
}
If you want this to be a background image, which I think you want.
Then you can use this method:
.home-section {
/* Location of the image */
background-image: url(images/background-photo.jpg);
/* Background image is centered vertically and horizontally at all times */
background-position: center center;
/* Background image doesn't tile */
background-repeat: no-repeat;
/* Background image is fixed in the viewport so that it doesn't move when
the content's height is greater than the image's height */
background-attachment: fixed;
/* This is what makes the background image rescale based
on the container's size */
background-size: cover;
/* Set a background color that will be displayed
while the background image is loading */
background-color: #464646;
}
It's responsive and will look good on all screens. And yes, you can ofcourse change the background images using jQuery or native JavaScript just like you've done with the images.
Best regards,
Can someone have a look to this fiddle http://jsfiddle.net/pkcwtone/1/ and tell me why I am not able to put the image all right inside the navigation?
This is html:
<nav id="mainNavigation" class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Responsive navigation -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-2"> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="">
<img src="http://s28.postimg.org/gc8ajkjq5/advance_logo.png" alt=""/>
</a>
</div>
<div class="clearfix"></div>
<div class="collapse navbar-collapse" id="navbar-collapse-2">
<!-- top navigation-->
<ul class="nav navbar-nav navbar-left">
<li>
Home
</li>
<li>
Accident<br>Management
</li>
<li>
Approved<br>Manufacturers
</li>
<li>
Our<br>Services
</li>
<li>
About<br>Advance
</li>
<li>
Contact<br>Us
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div>
</div>
</nav>
This is css:
#mainNavigation.navbar-default{
/*background: #f9540a;*/
background:black;
width: 100%;
text-align: center;
font-family:'Droid Sans', sans-serif;
font-weight:700;
font-size:1.2em;
}
#mainNavigation.navbar-header {
float: left;
padding: 15px;
text-align: center;
width: 100%;
}
#mainNavigation .container-fluid{
height:auto;
overflow:auto;
}
.navbar-brand img{
float:left;
}
I've been playing with overflow... with clearfix..... with the height.... but it looks bad :S The text overlays the logo, which it shouldn't (I know I could use padding, but I've though it must be a way more natural to keep in mind the space that the logo occupies), and then, the logo look cut! :S
Anyone can see what am I doing wrong?
Cheers :)
Looks like the issue is here:
#mainNavigation.navbar-header {
what the above css is looking for is a div with id mainNavigation and class nav-header
however you add a space between them, it looks for the class within the mainNavigation:
#mainNavigation .navbar-header {
you will be able to resize the navbar to fit the logo, see the updated jsfiddle:
http://jsfiddle.net/pkcwtone/4/
I am having trouble getting bootstrap 3's navabar to be responsive on a mobile device. The navbar continues to span further than the mobile display, and I cannot figure out what I did wrong.
The Code:
(HTML)
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigationbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand img-responsive" href="index.html">
<img src="img/logo.png" width="320" height="85" alt="">
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navigationbar">
<ul class="nav navbar-nav navbar-right">
<li>
Home
</li>
<li>
Getting Started
</li>
<li class="dropdown">
Products <b class="caret"></b>
<ul class="dropdown-menu">
<li>
Brain Seedâ„¢
</li>
</ul>
</li>
<li>
About Us
</li>
<li>
FAQ
</li>
<li>
Contact Us
</li>
<li>
<button type="button pull-right" class="btn btn-success">ORDER NOW</button>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
The Code: (CSS)
.navbar-fixed-top .nav {
padding: 20px 0;
}
.navbar-fixed-top .navbar-brand {
padding: 0 15px;
}
.page-content {
padding-top: 40px;
}
.img-center {
display: block;
margin: 0 auto;
}
.navbar .brand {
max-height: 40px;
max-width: 30%;
overflow: visible;
padding-top: 0;
padding-bottom: 0;
}
I notice you in your html code, you typed fixed height and width, which cancels the img-responsive class.
Start by removing that and go from there...enter link description here
I've been trying to determine how to do a background like having a negative margin. Here is a picture of what I have done as of now
The picture below show what I want as a result
Im trying to use a negative margin but no luck at all. Here is my code as of now
HTML
<div class="container">
<div class="navbar navbar-custom radius-fixer nomargin" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse nopaddingright">
<ul class="nav navbar-nav">
<li class="active">HOME</li>
<li>ABOUT US</li>
<li>FAQ</li>
<li>CONTACT US</li>
<li>ONLINE FORMS</li>
<li>VIRTUAL CLINIC TOUR</li>
<li>BLOG</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</div>
<div class="clearfix" id="main">
<div class="container">
<div class="flexslider nomargin">
<ul class="slides">
<li>
<img src="SLIDER1" />
</li>
<li>
<img src="SLIDER2" />
</li>
<li>
<img src="SLIDER3" />
</li>
</ul>
</div>
</div>
</div>
FOR MY CSS
#main{
background: #bf35bc;
background-position: top;
}
A reply is really appreciated.
You should be able to achieve what you want by applying a negative top margin to the main element:
margin-top: -40px;
That will pull the div up. See http://jsfiddle.net/raad/f6r1Lvf9/embedded/result/
EDIT
I have forked the Bootply example from the question, and added a negative top margin: http://www.bootply.com/5n8DsKXPQG
It appears to do what is needed.
this is negative top margin: margin-top: -50px;
so try
#main{
background: #bf35bc;
background-position: top;
margin-top: -50px;
}