Don't pay attention to the menu being awful above 789px. The "theoretical" task was to support only tablets and smartphones and I didn't bother to make the menu look fine on other devices. Just review it below 789px of VW.
Here's a codepen to demonstrate.
The page currently 100% matches the PSD designs and operates fine on all devices needed, though I am worried about the solutions I implemented to make it match.
Setting the
min-height
to navbar to custom size and thus control the vertically centered looks on Collapse Button and Logo Image usingpadding
. I had to setwidth: 70%
below 482px to.navbar-brand
so as the image resizes not to overflow.Maybe there's a way of more like "automatic" approach to the navbar size and menus being centered? I used some LESS to also count the paddings, but it also involved using
paddings
.Creating this
second-container-helper
class for the right section named "All Kinds of Birds" not to have thepadding-left
for the query above 768px, but have it for query below 768px.What is the better way to implement the looks? I mean, the "All Kinds of Birds" content not having the
padding-left
for above 768px, but have it below 768px so as it matches the PSD mockup.
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Document</title>
<!-- Styles Embedded -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/styles.css">
<!-- Embedded Font Awesome for the right-caret icon -->
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<div class="container-fluid">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapsed">
<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://php.atservers.net/test/images/logo.png" alt="">
</a>
</div> <!-- //.container-fluid (Brand and button wrapped together so as they don't affect navbar LIST items) -->
</div><!-- //.navbar-header -->
<div class="collapse navbar-collapse" id="navbar-collapsed">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Bird Information</a></li>
<li><a href="#">Contact</a></li>
</ul><!-- //.navbar-nav -->
</div> <!-- //.navbar-collapse -->
</nav>
<div class="row">
<div class="col-xs-12 col-sm-12">
<img src="http://php.atservers.net/test/images/bird-main.png" class="custom-img" alt="Hi, I'm a Bird">
</div> <!-- //.column -->
</div><!-- //.row -->
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-sm-12">
<p class="section-header">Find Birds In Your Area</p>
<select name="" id="">
<option value="" selected>Select Your Region</option>
<option value="">CA</option>
<option value="">FL</option>
<option value="">WA</option>
</select>
</div>
</div> <!-- //.row -->
</div> <!-- //.container-fluid -->
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-sm-12">
<p class="section-subheader">We'r Really Into Birds</p>
<p class="section-content"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis vitae, tenetur, ullam animi, expedita facere enim deleniti excepturi dolor reprehenderit cupiditate saepe quidem voluptatem blanditiis ea dolore facilis totam fugit.</p><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis vitae, tenetur, ullam animi, expedita facere enim deleniti excepturi dolor reprehenderit cupiditate saepe quidem voluptatem blanditiis ea dolore facilis totam fugit.</p></p>
</div><!-- //.column -->
</div> <!-- //.row-->
</div> <!-- //.container-fluid -->
<div class="row">
<div class="col-xs-12 col-sm-6 section-column">
<img src="http://php.atservers.net/test/images/tree-birds.png" alt="" class="custom-img">
<div class="container-fluid">
<div class="section">
<p class="section-subheader">Even Birds in Trees</p>
<p class="section-content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam excepturi voluptates harum fugit enim non, id porro repellendus soluta cupiditate consequuntur dignissimos dolorem sint corporis, illo aliquam blanditiis hic nam.</p>
<p class="section-content">
<a href="#" class="section-link"><i class="fa fa-caret-right"></i>Learn more about trees (and birds)</a>
</p>
</div> <!-- //.section -->
</div><!-- //.container-fluid -->
</div> <!-- //.column-->
<div class="col-xs-12 col-sm-6">
<img src="http://php.atservers.net/test/images/all-birds.png" alt="" class="custom-img">
<div class="second-container-helper"> <!-- Need that not to have left paddings @iPad, but have them @iPhone -->
<div class="section">
<p class="section-subheader">All Kinds of Birds</p>
<p class="section-content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est tenetur, reprehenderit at odio sit cumque neque placeat impedit praesentium soluta dolorum architecto qui molestias facilis voluptatibus, ut unde. Tenetur, provident.</p>
<p class="section-content">
<a href="#" class="section-link"><i class="fa fa-caret-right"></i>Learn more about trees (and birds)</a>
</p>
</div><!-- //.section -->
</div> <!-- //.second-container-helper -->
</div> <!-- //.column -->
</div><!-- //.row -->
<footer>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-sm-12">
<div class="footer-credits">
<p class="text-muted">® Registered trademark of An Amazing Company Name, an affiliate of independent Canadian birds</p>
<p class="text-muted">© Copyright 2014 An Amazing Company Name</p>
</div> <!-- //.footer-credits -->
</div><!-- //.column -->
<div class="col-xs-12 col-sm-12">
<ul class="footer-nav">
<li><a href="#">Home</a></li>
<li><a href="#">Terms of Use</a></li>
</ul>
</div><!-- //.column -->
</div> <!-- //.row -->
</div><!-- //.container-fluid -->
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="http://php.atservers.net/test/js/bootstrap.min.js"></script>
</body>
CSS
/* Global Styles */
img{
height: auto;
width: 100%;
display: block;
}
a{
color: #ff6600;
}
.container-fluid{
padding-left: 40px;
padding-right: 40px;
}
/* //Global Styles */
/* Navbar Styles */
.navbar{
min-height: 158px;
background-color: #ffffff;
margin-bottom: 0;
border: none;
}
.navbar-default{
border: none;
}
.navbar-brand{
margin-top: 36px;
}
.navbar-default .navbar-toggle{
margin-top: 58px;
}
.navbar-default .navbar-collapse{
border-color: transparent;
}
.navbar-collapse.in{
margin-top: 65px;
}
.collapsing{
margin-top: 65px;
}
/* Navbar Colors and Fonts */
.navbar-nav{
background-color: #ff6600;
padding-left: 40px;
padding-right: 40px;
margin: 0 -15px;
}
.navbar-default .navbar-nav > li > a{
color: #ffffff;
border-top: 1px solid #fff;
}
.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{
background-color: transparent;
color: #fff;
border-top: none;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus{
color: #fff;
}
/* //Navbar Colors and Fonts */
.nav li:before{
font-family: 'Glyphicons Halflings';
content: "\e080";
float: right;
color: #fff;$
padding-top: 10px;
}
/* //Navbar Styles */
/* Select Styles */
select{
width: 100%;
background-color: #ffffff;
height: 60px;
font-size: 24px;
color: #c7c7cc;
border: 2px solid #c7c7cc;
border-radius: 4px;
-webkit-appearance: none;
background: url('../images/dropdown-arrow.png') no-repeat right;
background-position: 98%;
}
/* //Select Styles */
/* Section Styles */
.section{
margin-bottom: 30px;
}
.section-header{
font-weight: bold;
font-size: 30px;
color: #ff6600;
padding-top: 30px;
padding-bottom: 30px;
}
.section-subheader{
font-size: 28px;
color: #ff6600;
padding-top: 36px;
padding-bottom: 16px;
}
.section-content{
color: #999999;
font-size: 18px;
}
.section-link{
font-size: 14px;
}
.fa-caret-right{
padding-right: 10px;
}
.container-helper{
padding-right: 40px;
}
/* //Section Styles */
/* Media Queries */
/* Fix for iPhone select font size */
@media screen and (max-width: 482px){
select{
font-size: 18px;
}
}
/* // Fix for iPhone */
/* Section Media Queries Helpers */
/* container in 2nd section has left padding below 768px to match PSD design */
@media screen and (max-width: 768px){
.second-container-helper{
padding-left: 40px;
}
}
/* container in the left section doesnt have right padding after 768px, but has it below 768px */
@media screen and (min-width: 768px){
.section-column .container-fluid{
padding-right: 0;
}
}
/* //Section Media Queries Helpers */
/* Logo img resizes below 482px */
@media screen and (max-width: 482px){
.navbar-brand{
width: 70%;
margin-top: 46px;
height: auto;
}
}
/* //Logo img resizes below 482px */
/* //Media Queries */
/* Footer Styles*/
footer{
margin-top: 80px;
}
.footer-credits{
border-top: 1px solid #c7c7cc;
}
.footer-nav{
list-style: none;
padding-left: 0;
}
.footer-nav li{
float: left;
padding: 5px;
}
.footer-nav li a{
border-right: 1px solid #c7c7cc;
padding-right: 10px;
}
.footer-nav li:last-child a{
border-right: none;
}
/* Footer Styles */