assets
folder, which you can find in the archive with Bootstrap:fonts
folder to the project root folder. Open the javascripts
folder and copy the bootstrap.js
file in the js
folder. Finally, open the stylesheets
folder and copy the bootstrap.scss
file and bootstrap
folder to the css
directory. The structure of our project should look like this:instafeed.min.js
and Modernizr
to the js
folder. Now we need to customize something else before we start building the template.css
folder Add a file called style.scss
. Then in the js
folder, add a file called app.js
index.html
file and paste in the following HTML code: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width,user-scalable=no"> <title>Instagram Portfolio</title> <link href='http://fonts.googleapis.com/css?family=Lato:400,700|Kaushan+Script|Montserrat' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="css/style.css"> <script type="text/javascript" src="js/modernizr.js"></script> </head> <body> <header> </header> <section class="instagram-wrap"> </section> <footer> </footer> <section class="footer-bottom"> </section> </body> </html>
<head>
section contains the required viewport tag for correct media queries. We then assigned a <link>
for various Google fonts . Next, we have prescribed tags containing style.css
and Modernizr.<body>
contains four main elements to which we applied classes in order to understand what it serves for.footer-bottom
section: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> <script type="text/javascript" src="js/instafeed.min.js"></script> <script type="text/javascript" src="js/app.js"></script>
style.scss
file. /* * */ $main-font: 'Lato', sans-serif; $sub-font: 'Montserrat', sans-serif; $fancy-font: 'Kaushan Script', cursive; $font-size: 16px; $black: #000; $white: #FFF; $grey: #585c65; $mediumgrey: #9b9b9b; $lightgrey: #eeeeee; $blue: #3466a1; $padding: 10px; $margin: 10px; /* * Bootstrap */ $font-family-sans-serif: $main-font; @import 'bootstrap';
* { position: relative; box-sizing: border-box; } body { color: $grey; font-size: $font-size; } header { max-height: 600px; height: 600px; overflow: hidden; }
*
to give all objects the position: relative
parameter. In addition, it is practical to set the box-sizing
parameter to the border-box
so that we can use percentages in the future when setting the width of objects.<header>
section. <img src="images/mountains.jpg" alt="Mountains"> <div class="name fancy-font"> Jonathan </div> <div class="titles"> <h1>Hello! <span>I'm Jonathan</span></h1> <h2>I love to travel all around the world and design beautiful things</h2> </div> <div class="social"> <a class="facebook" href="#">Facebook</a> <a class="twitter" href="#">Twitter</a> <a class="instagram" href="#">Instagram</a> </div>
<header>
section.header
section, which is in our Sass file. img { position: fixed; /* */ top: 0px; left: 50%; margin-left: -600px; width: 1200px; @media screen and (min-width: $screen-lg) { top: auto; /* */ left: auto; margin: 0; width: 100%; } }
.name { font-size: 21px; position: absolute; top: 50px; left: 50px; color: $white; } .titles { position: absolute; bottom: 40%; width: 100%; text-align: center; @media screen and (min-width: $screen-lg) { bottom: 50%; } } h1, h2 { width: 100%; color: $white; margin: 0; }
h1 { text-transform: uppercase; font-weight: 700; font-size: 36px; letter-spacing: 0.06em; margin-bottom: $margin; span { display: block; @media screen and (min-width: $screen-md) { display: inline; } } } h2 { font-size: 16px; width: 70%; margin: 0 auto; @media screen and (min-width: $screen-lg) { width: 100%; margin: 0; } }
.fancy-font { font-family: $fancy-font; }
social-sprite@2x.png
in the image folder. Now you need to save images with sizes for standard displays (not Retina). This can be done directly in the Save for Web window. It is important that the image size is 76px by 52px. Save the file as social-sprite.png
and also place it in the folder with the images.header
section immediately after the h1
and h2
styles. .social { position: absolute; top: 55px; right: 50px; overflow: hidden; a { float: left; width: 26px; height: 26px; margin: 0 5px; text-indent: -9999px; /* */ background: url(../images/social-sprite.png) no-repeat; opacity: 0.8; &:hover { opacity: 1.0; } @media screen and (-webkit-min-device-pixel-ratio: 2), screen and (-min-device-pixel-ratio: 2) { background: url(../images/social-sprite@2x.png) no-repeat; background-size: 76px 26px; } &.facebook { background-position: 0px 0px; } &.twitter { background-position: -25px 0px; } &.instagram { background-position: -50px 0px; } } }
index.html
page, so insert the following year into it in the <section class="instagram-wrap">
<div class="container"> <div class="row"> <div class="col-xs-12"> <div class="instagram-content"> <h3>Latest Photos</h3> <div class="row photos-wrap"> <!-- div Instafeed --> <div id="instafeed"></div> <!-- --> <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3"> <div class="photo-box"> <div class="image-wrap"> <img src=""> <div class="likes">309 Likes</div> </div> <div class="description"> Fantastic Architecture #architecture #testing <div class="date">September 16, 2014</div> </div> </div> </div> </div> </div> </div> </div> </div>
col-xs-xx
, col-sm-xx
, col-md-xx
, col-lg-xx
to optimize the display of all elements on screens of various resolutions. The Bootstrap grid consists of containers (containers), rows (rows) and columns (column). Each row is inside the container and each column is inside the row . In addition, there should be a total of 12 columns in each row. .instagram-wrap { background: $lightgrey; } .instagram-content { h3 { text-transform: uppercase; letter-spacing: 0.5em; font-size: 12px; font-weight: 700; text-align: center; padding: $padding*5 0; color: darken($lightgrey, 20%); } }
header
block in our Sass file. .photo-box { margin: 0 0 $margin*3 0; .image-wrap { img { width: 100%; } .likes { position: absolute; bottom: 5px; left: 15px; padding: $padding/2; background: $black; background: rgba($black, 0.4); color: $white; } } .description { font-family: $sub-font; font-size: 12px; background: $white; color: $mediumgrey; letter-spacing: 1px; padding: $padding*1.5; height: 75px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } }
h3
element, which is located in the .instagram-content
section. Let's see what we got:app.js
file: $(function() { // instafeed var feed = new Instafeed({ clientId: '97ae5f4c024c4a91804f959f43f2635f', target: 'instafeed', get: 'tagged', tagName: 'photographyportfolio', links: true, limit: 8, sortBy: 'most-recent', resolution: 'standard_resolution', template: '<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3"><div class="photo-box"><div class="image-wrap"><a href="{{link}}"><img src="{{image}}"></a><div class="likes">{{likes}} Likes</div></div><div class="description">{{caption}}<div class="date">{{model.date}}</div></div></div></div>' }); feed.run(); });
feed
variable and give it the value of Instafeed
.clientId
- Client ID that you received on Instagram.target
- the ID of the element on the page on which images will be displayed.get
- Instafeed plugin mode. Using 'tagged', we tell Instafeed to look for photos on the hashtag.tagName
- The name of the tag to search by.links
- When you click on the image, the link directs the user to Instagramlimit
- Limit received images. Useful for creating pages.sortBy
- How will the resulting images be sorted. The parameter most-recent
means that the images will be sorted by date.resolution
- Image size.template
- A template for HTML image processing on a page.index.html
file and find the following code: <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3"> <div class="photo-box"> <div class="image-wrap"> <img src=""> <div class="likes">309 Likes</div> </div> <div class="description"> Fantastic Architecture #architecture #testing <div class="date">September 16, 2014</div> </div> </div> </div>
index.html
file and add the following code inside the <footer>
element. <div class="container"> <div class="row"> <div class="col-xs-12"> <h4>Get in touch</h4> <p class="about-text">I shoot, design and write. Don't hesitate and get in touch with me if you need some creative work done. I always work to achieve my best and fulfil client needs</p> <a class="contact-now-btn" href="#">Contact Now</a> </div> </div> </div>
footer { background: $white; padding: $padding*3 0; text-align: center; @media screen and (min-width: $screen-lg) { padding: $padding*10 0; } h4 { font-size: 36px; text-align: center; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; } .about-text { padding: 0 $padding*3; @media screen and (min-width: $screen-lg) { width: 650px; margin: 0 auto; } } .contact-now-btn { display: inline-block; width: 70%; padding: $padding*2 $padding*5; margin-top: $margin*2; color: $white; background: $grey; font-size: 13px; letter-spacing: 1px; text-decoration: none; text-transform: uppercase; @media screen and (min-width: $screen-md) { width: 60%; } @media screen and (min-width: $screen-lg) { width: 20%; margin-top: $margin*5; } &:hover { background: lighten($grey, 5%); } } }
.footer-bottom
. <section class="footer-bottom"> 2014 © Jonathan White. All rights reserved. </section>
.footer-bottom { background: $white; padding: $padding $padding*6; border-top: 2px solid $lightgrey; letter-spacing: 2px; text-align: center; color: $mediumgrey; text-transform: uppercase; @media screen and (min-width: $screen-md) { padding: $padding*4 0; } }
Source: https://habr.com/ru/post/242643/
All Articles