हमारे स्केलेटन पेज बनाने के लिए स्टाइल्स जोड़ना
() translation by (you can also view the original English article)
हमारी चालू निर्माण प्रक्रिया के इस भाग में हम HTML को स्टाइल करने पर ध्यान केंद्रित करने जा रहे हैं। इस ट्यूटोरियल में तीन मुख्य भाग होंगे:
- इमेजेज जोड़ना
- वेब फोंट में गुप्त फ़ॉन्ट
- प्रत्येक अनुभाग स्टाइलिंग
आइए हम अपने आप को याद दिलाना चाहते हैं कि हमने अभी तक क्या बनाया है:



ध्यान में रखते हुए हम इसके लिए लक्ष्य कर रहे हैं, हमारे पास एक निष्पक्ष बिट है!
इमेजेज जोड़ना
प्रत्येक अनुभाग के लिए बैकग्राउंड इमेज फसल के बजाय, हम www.unsplash.com से इमेजेज को डाउनलोड करने जा रहे हैं, जिनमें इमेजेज का उपयोग करने के लिए बड़े और निःशुल्क हैं। हम निम्नलिखित इमेजेज का उपयोग करने जा रहे हैं:
एक नया फ़ोल्डर बनाएं, इसे "इमेजेज" कहते हैं और वहां इमेजेज डाउनलोड करें। अगर आप कुछ और किलोबाइट्स को मुंह बंद करने के लिए ऑप्टिमाइज़ और रिवैक्ट करना चाहते हैं तो वह नि: शुल्क है।
इसके अलावा, हमारे पोर्टफोलियो इमेजेज के लिए, हम कुछ अच्छा trianglify images को तोड़ने जा रहे हैं।



छह SVG फाइलों को डाउनलोड करें और उन्हें "images/portfolio" फ़ोल्डर में रखें, प्रत्येक फ़ाइल को इस प्रकार नाम दिया जाना चाहिए: "work_1.svg", "work_2.svg" ... "work_6.svg"।
ग्राहकों, लोगों और सेवाओं के वर्गों के लिए, हम PSD से इमेजेज को निर्यात करने जा रहे हैं। मैं इस प्रक्रिया में बहुत गहरा नहीं जाऊंगा, क्योंकि एक PSD से इमेजेज को निर्यात करने के बारे में बहुत सारे ट्यूटोरियल हैं। उपकरण जिसे मैं व्यक्तिगत रूप से पसंद और प्रयोग करता हूं, दैनिक आधार पर, इमेजेज को निर्यात करने के लिए Semser कहा जाता है।
प्रत्येक अनुभाग की इमेज को एक प्रासंगिक निर्देशिका "images/section_name" के अंतर्गत रखा जाना चाहिएI फ़ोल्डर संरचना इस तरह दिखनी चाहिए:



फ़ॉन्ट्स को वेबफॉन्ट में कनवर्ट करें
PSD में प्रयुक्त फोंम हैं Amble, SlimJohn & BigJohn और FontAwesome।
SlimJoe और BigJohn फोंट के लिए, हम FontSquirrel का उपयोग otf से वेबफॉन्ट में बदलने के लिए करेंगे। FontSquirrel पर जाएं और यहां से डाउनलोड किए गए फ़ॉन्ट अपलोड करें। स्क्रीन को इस प्रकार दिखना चाहिए:
महत्वपूर्ण: जब भी आप एक परिवर्तनीय टूल का उपयोग करते हैं जैसे कि फोंटक्वायरल, तो आपको यह सुनिश्चित करने की ज़रूरत है कि आप जिस फ़ॉन्ट फाइल को परिवर्तित कर रहे हैं उसके पास उचित लाइसेंस हो।



FontSquirrel रूपांतरण समाप्त हो गया है के बाद, आप किट डाउनलोड कर सकते हैं। संग्रह के अंदर आपके पास निम्न फ़ाइलें हैं:



हम Amble, SlimJoe & BigJohn और FontAwesome डाउनलोड करने के बाद सब कुछ साफ रखने के लिए, हमें प्रत्येक फ़ॉन्ट पैक को "फोंट" फ़ोल्डर में ले जाने की आवश्यकता है। फोंट के लिए फ़ोल्डर संरचना इस तरह दिखनी चाहिए:



ठीक है, अब हम "इमेजेज" और "फोंट" फ़ोल्डरों के साथ काम कर रहे हैं, शेष कार्य PSD के अनुसार वर्गों को स्टाइल देना है, तो हम आगे वाले भाग में आगे बढ़ें।
स्टाइलिंग सेक्शन
पिछले ट्यूटोरियल में प्रस्तुत प्रत्येक अनुभाग में कुछ CSS छूने की जरूरत है, ताकि PSD को देखा और महसूस किया जा सके। चलो एक नई फाइल बनाकर शुरू करें, जिसे "style.css" कहा जाता है, जहां हम वर्गों के लिए हमारी सभी कस्टम css लिखना चाहते हैं।
नोट: आप एक पूर्वप्रोसेसर जैसे Sass या LESS का उपयोग कर आराम कर सकते हैं, इस मामले में आप अपनी फ़ाइलों को एक में जोड़ देंगे, लेकिन वैश्विक अपील के लिए हम इस ट्यूटोरियल में अच्छी राजभाषा CSS में चिपकाएंगे।
इसलिए, संक्षेप में, हमने अपने फोंट को वेबफॉन्ट में परिवर्तित कर दिया है और अब हमें अपने CSS में संदर्भ देने की जरूरत है। Amble, SlimJoe और BigJohn फोंट के लिए कोड इस तरह दिख रहा है:
1 |
/* Fonts */
|
2 |
/* Generated by Font Squirrel (http://www.fontsquirrel.com) */
|
3 |
|
4 |
/* SlimJoe */
|
5 |
@font-face { |
6 |
font-family: 'slim_joeregular'; |
7 |
src: url('../fonts/SlimJoe/slim_joe-webfont.eot'); |
8 |
src: url('../fonts/SlimJoe/slim_joe-webfont.eot?#iefix') format('embedded-opentype'), |
9 |
url('../fonts/SlimJoe/slim_joe-webfont.woff2') format('woff2'), |
10 |
url('../fonts/SlimJoe/slim_joe-webfont.woff') format('woff'), |
11 |
url('../fonts/SlimJoe/slim_joe-webfont.ttf') format('truetype'), |
12 |
url('../fonts/SlimJoe/slim_joe-webfont.svg#slim_joeregular') format('svg'); |
13 |
font-weight: normal; |
14 |
font-style: normal; |
15 |
}
|
16 |
|
17 |
/* BigJohn */
|
18 |
@font-face { |
19 |
font-family: 'big_johnregular'; |
20 |
src: url('../fonts/BigJohn/big_john-webfont.eot'); |
21 |
src: url('../fonts/BigJohn/big_john-webfont.eot?#iefix') format('embedded-opentype'), |
22 |
url('../fonts/BigJohn/big_john-webfont.woff2') format('woff2'), |
23 |
url('../fonts/BigJohn/big_john-webfont.woff') format('woff'), |
24 |
url('../fonts/BigJohn/big_john-webfont.ttf') format('truetype'), |
25 |
url('../fonts/BigJohn/big_john-webfont.svg#big_johnregular') format('svg'); |
26 |
font-weight: normal; |
27 |
font-style: normal; |
28 |
}
|
29 |
|
30 |
/* == http://www.fontsquirrel.com/fonts/amble */
|
31 |
|
32 |
/* Amble Regular */
|
33 |
@font-face { |
34 |
font-family: 'ambleregular'; |
35 |
src: url('../fonts/Amble/Regular/Amble-Regular-webfont.eot'); |
36 |
src: url('../fonts/Amble/Regular/Amble-Regular-webfont.eot?#iefix') format('embedded-opentype'), |
37 |
url('../fonts/Amble/Regular/Amble-Regular-webfont.woff') format('woff'), |
38 |
url('../fonts/Amble/Regular/Amble-Regular-webfont.ttf') format('truetype'), |
39 |
url('../fonts/Amble/Regular/Amble-Regular-webfont.svg#ambleregular') format('svg'); |
40 |
font-weight: normal; |
41 |
font-style: normal; |
42 |
}
|
43 |
|
44 |
/* Amble Bold */
|
45 |
@font-face { |
46 |
font-family: 'amblebold'; |
47 |
src: url('../fonts/Amble/Bold/Amble-Bold-webfont.eot'); |
48 |
src: url('../fonts/Amble/Bold/Amble-Bold-webfont.eot?#iefix') format('embedded-opentype'), |
49 |
url('../fonts/Amble/Bold/Amble-Bold-webfont.woff') format('woff'), |
50 |
url('../fonts/Amble/Bold/Amble-Bold-webfont.ttf') format('truetype'), |
51 |
url('../fonts/Amble/Bold/Amble-Bold-webfont.svg#amblebold') format('svg'); |
52 |
font-weight: normal; |
53 |
font-style: normal; |
54 |
}
|
55 |
|
56 |
/* Amble Light */
|
57 |
@font-face { |
58 |
font-family: 'amblelight'; |
59 |
src: url('../fonts/Amble/Light/Amble-Light-webfont.eot'); |
60 |
src: url('../fonts/Amble/Light/Amble-Light-webfont.eot?#iefix') format('embedded-opentype'), |
61 |
url('../fonts/Amble/Light/Amble-Light-webfont.woff') format('woff'), |
62 |
url('../fonts/Amble/Light/Amble-Light-webfont.ttf') format('truetype'), |
63 |
url('../fonts/Amble/Light/Amble-Light-webfont.svg#amblelight') format('svg'); |
64 |
font-weight: normal; |
65 |
font-style: normal; |
66 |
}
|
FontAwesome एक CSS फ़ाइल प्रदान करता है, जिसे font-awesome.css कहा जाता है, जो कि css फ़ोल्डर में जगह होने की आवश्यकता होती है। style.css और font-awesome.css दोनों को सूचकांक के भीतर संदर्भ की आवश्यकता है क्योंकि आप नीचे दिए गए स्निपेट से देख सकते हैं।
1 |
<!-- CSS
|
2 |
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
3 |
<link rel="stylesheet" href="css/normalize.css"> |
4 |
<link rel="stylesheet" href="css/skeleton.css"> |
5 |
<link rel="stylesheet" href="css/font-awesome.css"> |
6 |
<link rel="stylesheet" href="css/style.css"> |
स्टाइल फ़ाइलों के संदर्भों को जोड़ने के बाद, चलो css/style.css में कूदते हैं और स्केलटन डिफॉल्ट को ओवरराइट करते हुए कुछ डिफ़ॉल्ट स्टाइल जोड़ते हैं। सबसे पहले जो मैं करना चाहता हूं वह सभी तत्वों को box-sizing
जोड़ना है:
1 |
/* Personal Flavour */
|
2 |
* { |
3 |
-webkit-box-sizing: border-box; |
4 |
-moz-box-sizing: border-box; |
5 |
-ms-box-sizing: border-box; |
6 |
box-sizing: border-box; |
7 |
}
|
अब टाइपोग्राफी फिर से लिखना शुरू हो रहा है। चूंकि डिजाइनर ने कस्टम फोंट्स को जोड़ा और हमने पहले से ही उन्हें वेब फोंट में बदल दिया है, हमें उन्हें हेडिंग, पैराग्राफ और बॉडी में असाइन करना होगा। वेबसाइट डिजाइन करते वक्त टाइपोग्राफी एक महत्वपूर्ण भूमिका निभाती है; हमें यह सुनिश्चित करने की ज़रूरत है कि हम डिजाइनर विनिर्देशों को पूरा करते हैं।
1 |
/* Typography */
|
2 |
|
3 |
body { |
4 |
font-size: 16px; |
5 |
letter-spacing: .05em; |
6 |
color: #222222; |
7 |
font-family: "amblelight", "Raleway", Helvetica, Arial, sans-serif; |
8 |
}
|
9 |
h1, h3{ |
10 |
font-family: "big_johnregular", "Raleway", "Helvetica Neue", Helvetica, Arial, sans-serif; |
11 |
}
|
12 |
h4 { |
13 |
font-size: 22px; |
14 |
}
|
15 |
h3 { |
16 |
font-size: 28px; |
17 |
}
|
जैसा कि आप स्निपेट से देख सकते हैं, h1
और h3
समान font-family
, BigJohn share करते हैं हमें body
के टाइपोग्राफी के लिए कुछ बदलाव करने की भी आवश्यकता है, जैसे font-size
, letter-spacing
, color
और font-family
।
यदि आप पहले भाग को याद करते हैं, जब हमने HTML लिखा था, हमने कुछ कस्टम उपयोगि क्लासेज केंद्र तत्वों के लिए बनाई हैं, और विभाजक क्लास में भी दो अलग-अलग रंग हैं, #222
(गहरे भूरे रंग) और #d87843
(नारंगी)। एक तत्व को केन्द्रित करने के लिए हम इसे पूरी तरह से स्थानांतरित करने के लिए जा रहे हैं और इसे सही ढंग से स्थिति में transform
के लिए संपत्ति का उपयोग करें।
1 |
.centered { |
2 |
position: absolute; |
3 |
top: 50%; |
4 |
left: 50%; |
5 |
-webkit-transform: translate(-50%,-50%); |
6 |
-moz-transform: translate(-50%,-50%); |
7 |
-ms-transform: translate(-50%,-50%); |
8 |
-o-transform: translate(-50%,-50%); |
9 |
transform: translate(-50%,-50%); |
10 |
}
|
11 |
.vertical-centered { |
12 |
position: absolute; |
13 |
top: 50%; |
14 |
-webkit-transform: translateY(-50%); |
15 |
-moz-transform: translateY(-50%); |
16 |
-ms-transform: translateY(-50%); |
17 |
-o-transform: translateY(-50%); |
18 |
transform: translateY(-50%); |
19 |
width: 100%; |
20 |
}
|
यहां विचार यह है कि यह वर्तमान तत्व के आयामों को लेता है और इसके साथ आगे बढ़ता है। उदाहरण के लिए, translateY(-50%)
तत्व की ऊंचाई को 50% तक बढ़ाएगा।
पिछले ट्यूटोरियल में, हमने डिज़ाइन की रेखा बनाने के लिए एक पृथक क्लास के साथ एक तत्व बनाया है। स्टाइल बहुत कम है, लेकिन यहां यह चाल है कि हम इसका उपयोग करते हैं छद्म तत्व से :before
इसे दृश्यमान बनाने के लिए। विभाजक class केवल अंतरण और टेक्स्ट संरेखण के लिए सहायक है।
1 |
/* Separator */
|
2 |
|
3 |
.separator { |
4 |
position: relative; |
5 |
margin-bottom: 1.7em; |
6 |
padding-bottom: 1.7em; |
7 |
text-align: center; |
8 |
font-weight: bold; |
9 |
text-transform: uppercase; |
10 |
color: inherit; |
11 |
}
|
12 |
.separator:before { |
13 |
content: ''; |
14 |
position: absolute; |
15 |
top: 100%; |
16 |
left: 50%; |
17 |
width: 86px; |
18 |
height: 2px; |
19 |
background-color: #222; |
20 |
|
21 |
-webkit-transform: translateX(-50%); |
22 |
-ms-transform: translateX(-50%); |
23 |
-o-transform: translateX(-50%); |
24 |
transform: translateX(-50%); |
25 |
}
|
26 |
.separator.orange:before { |
27 |
background-color: #d87843; |
28 |
}
|
स्केलेटन बटन के लिए पूर्वनिर्धारित स्टाइल्स के साथ आता है:



हमारे डिजाइन में एक और दो भिन्न प्रकार के बटन होते हैं, जिनमें से एक की रूपरेखा होती है और दूसरा जो वीडियो अनुभाग से प्ले बटन के लिए गोल होता है।
1 |
/* Button inverted */
|
2 |
|
3 |
.button.inverted { |
4 |
font-size: inherit; |
5 |
padding: 25px 70px; |
6 |
color: white; |
7 |
height: auto; |
8 |
border: 3px solid white; |
9 |
text-transform: none; |
10 |
font-size: 26px; |
11 |
font-family: "ambleregular"; |
12 |
}
|
13 |
|
14 |
.button.inverted:hover { |
15 |
background: white; |
16 |
color: #222; |
17 |
}
|
18 |
|
19 |
.button.circle { |
20 |
padding: 0; |
21 |
width: 2.5em; |
22 |
height: 2.5em; |
23 |
line-height: 2.5em; |
24 |
border-radius: 50%; |
25 |
text-align: center; |
26 |
-webkit-box-sizing: content-box; |
27 |
-moz-box-sizing: content-box; |
28 |
-ms-box-sizing: content-box; |
29 |
box-sizing: content-box; |
30 |
}
|
उल्लिखित बटन बनाने के लिए अतिरिक्त वर्ग उल्टा है, और रंग और सीमा के लिए एक पारदर्शी बैकग्राउंड और #222
है। हॉवर पर, बैकग्राउंड रंग #222
है और टेक्स्ट का रंग white
है। मैंने रिक्ति और डिजाइन प्रयोजनों के लिए इसके लिए पर्याप्त पैडिंग भी जोड़ा है।
सेक्शंस के लिए डिफ़ॉल्ट स्टाइल्स
यदि आपको याद है, प्रत्येक सेक्शन की क्लास का नाम अलग है जिसे हम अभी लक्षित करना चाहते हैं। यहां पूरे विचार यह है कि प्रत्येक अनुभाग में background-color
या background-image
होनी चाहिए।
इसके अलावा, एक बैकग्राउंड इमेज वाले क्लास, दोहराव से बचने के लिए, एक और श्रेणी में featured-bg-image
होती है, जो मूल रूप से बैकग्राउंड-इमेज स्थिति, आकार और ओपेसिटी सेट करती है, और बैकग्राउंड-कवर इफ़ेक्ट बनाता है जो इमेज को फैला देगा कंटेनर साइज में।
प्रत्येक अनुभाग में top
और bottom
के लिए 80px
पैडिंग और left
और right
के लिए 0px
है।
1 |
/* =Section general styling
|
2 |
-------- */
|
3 |
|
4 |
section { |
5 |
text-align: center; |
6 |
padding: 80px 0; |
7 |
}
|
8 |
|
9 |
/*
|
10 |
|
11 |
Section with featured background image. Every section which will have this
|
12 |
class will get the effect with a background cover.
|
13 |
|
14 |
*/
|
15 |
|
16 |
.featured-bg-image { |
17 |
position: relative; |
18 |
background-color: #222222; |
19 |
color: white; |
20 |
min-height: 500px; |
21 |
}
|
22 |
|
23 |
.featured-bg-image:before { |
24 |
content: ''; |
25 |
position: absolute; |
26 |
top: 0; right: 0; left: 0; bottom: 0; |
27 |
background-size: cover; |
28 |
background-position: 50% 50%; |
29 |
background-repeat: no-repeat; |
30 |
opacity: .35; |
31 |
}
|
32 |
|
33 |
.help:before { |
34 |
background: url("../images/help_bg_image.jpg"); |
35 |
}
|
36 |
|
37 |
.creativity:before { |
38 |
background: url("../images/creativity_bg_image.jpg"); |
39 |
background-position: 50% 0; |
40 |
}
|
41 |
|
42 |
.quote:before { |
43 |
background: url("../images/quote_bg_image.jpg"); |
44 |
}
|
45 |
|
46 |
.video-iframe{ |
47 |
position: absolute; |
48 |
left: 0; top: 0; bottom: 0; right: 0; |
49 |
height: 100%; |
50 |
width: 100%; |
51 |
display: none; |
52 |
}
|
53 |
|
54 |
.video:before { |
55 |
background: url("../images/video_bg_image.jpg"); |
56 |
}
|
57 |
|
58 |
.clients { |
59 |
background-color: #f4f4f4; |
60 |
}
|
61 |
|
62 |
.footer { |
63 |
background-color: #222222; |
64 |
color: white; |
65 |
}
|
नेविगेशन
नेविगेशन एक hamburger icon और लिंक की एक अनोखी सूची से आता है। नेविगेशन ठीक है, स्क्रॉल करते समय सब कुछ ऊपर रहने के लिए। इसमें 320px
की चौड़ाई और 100%
की ऊंचाई है। वेबसाइट के बाहर नेविगेशन रखने के लिए, हम transform
translate
संपत्ति का उपयोग कर रहे हैं (जो हम केंद्र तत्वों के लिए भी इस्तेमाल करते थे), लेकिन इस बार हम इसे अपनी width
का 100%
अनुवाद करते हैं, इसलिए यह दृश्यमान नहीं होगा।
नेविगेशन के अंदर लिंक अपरकेस टेक्स्ट, एक सफेद color
और 100%
width
है। मैंने लिंक पर प्रस्तुत text-decoration
को भी हटा दिया और font-weight
बोल्ड बनाया।
हैम्बर्गर आइकन में font-size
और सफेद color
के लिए 30px
है, जिसमें लगभग 20px
padding
है। मैंने background-color
और active
स्टेट के लिए एक संक्रमण इफ़ेक्ट भी जोड़ा है। जिस चीज़ पर मैं अधिक ध्यान देना चाहता हूं वह हैमबर्गर आइकन का स्थान है, क्योंकि जैसा कि आप डिज़ाइन में देख सकते हैं, इसे नेविगेशन के "बाहर" रखा गया है। इस के लिए त्वरित समाधान यह पूर्ण और 100% बाएं स्थान देना है। left: 100%
नेविगेशन चौड़ाई का प्रतिनिधित्व करता है, इसलिए अब हम नेविगेशन चौड़ाई बढ़ा सकते हैं और आइकन हमेशा इसके बाहर रहेंगे।
1 |
/* =Navigation
|
2 |
-------- */
|
3 |
|
4 |
.navigation { |
5 |
position: fixed; |
6 |
top: 0; left: 0; bottom: 0; |
7 |
height: 100%; |
8 |
z-index: 3; |
9 |
width: 320px; |
10 |
-webkit-transform: translateX(-100%); |
11 |
-moz-transform: translateX(-100%); |
12 |
-ms-transform: translateX(-100%); |
13 |
-o-transform: translateX(-100%); |
14 |
transform: translateX(-100%); |
15 |
|
16 |
-webkit-transition: all .5s ease-in-out; |
17 |
-moz-transition: all .5s ease-in-out; |
18 |
-ms-transition: all .5s ease-in-out; |
19 |
-o-transition: all .5s ease-in-out; |
20 |
transition: all .5s ease-in-out; |
21 |
}
|
22 |
|
23 |
.navigation.active { |
24 |
-webkit-transform: translateX(0); |
25 |
-moz-transform: translateX(0); |
26 |
-ms-transform: translateX(0); |
27 |
-o-transform: translateX(0); |
28 |
transform: translateX(0); |
29 |
}
|
30 |
|
31 |
.navigation ul { |
32 |
list-style: none; |
33 |
position: absolute; |
34 |
top: 0; |
35 |
left: 0; |
36 |
bottom: 0; |
37 |
right: 0; |
38 |
margin: 0; |
39 |
background: #222; |
40 |
}
|
41 |
.navigation ul li { |
42 |
display: block; |
43 |
text-align: center; |
44 |
margin: 0; |
45 |
padding: 0; |
46 |
}
|
47 |
.navigation ul li a { |
48 |
display: block; |
49 |
height: 100%; |
50 |
padding: 10px 0; |
51 |
|
52 |
text-decoration: none; |
53 |
text-transform: uppercase; |
54 |
color: white; |
55 |
font-weight: 900; |
56 |
}
|
57 |
|
58 |
.navigation ul li a.current, |
59 |
.navigation ul li a:hover { |
60 |
color: #222; |
61 |
background-color: white; |
62 |
}
|
63 |
|
64 |
.navigation .menu-icon { |
65 |
color: white; |
66 |
font-size: 30px; |
67 |
line-height: 1em; |
68 |
|
69 |
position: absolute; |
70 |
left: 100%; |
71 |
padding: 20px; |
72 |
|
73 |
-webkit-transition: all .15s ease-in-out; |
74 |
-moz-transition: all .15s ease-in-out; |
75 |
-ms-transition: all .15s ease-in-out; |
76 |
-o-transition: all .15s ease-in-out; |
77 |
transition: all .15s ease-in-out; |
78 |
}
|
79 |
|
80 |
.navigation .menu-icon.active { |
81 |
background-color: rgba(0,0,0, .3); |
82 |
}
|
83 |
.navigation .menu-icon:hover { |
84 |
color: #222; |
85 |
background-color: transparent; |
86 |
}
|
हीरो सेक्शन
हीरो सेक्शन विशेष रूप से बैकग्राउंड इमेजेज वाली क्लासेज के समान स्टाइल को संभालता है, लेकिन अब हम एक अलग दृष्टिकोण चाहते हैं, क्योंकि इसके लिए कई स्टाइलिंग हैं। यह बैकग्राउंड-इमेज से बैकग्राउंड के रूप में, एक रंग भरने के रूप में एक बैकग्राउंड रंग, एक ग्रेडिएंट ओवरले और एक अलग ऊंचाई: 500px से बना है।
ग्रेडिएंट-ओवरले इफ़ेक्ट CSS3 Gradient का उपयोग करके छद्म तत्व (:after
) बनाया गया है। मैंने इस आशय को बनाया है क्योंकि यह हमें फोटोशॉप खोलने के बिना इमेज सौंदर्य बदलने का लचीलापन देता है।
1 |
/* =Hero
|
2 |
-------- */
|
3 |
|
4 |
.hero { |
5 |
padding: 0; |
6 |
min-height: 500px; |
7 |
text-align: center; |
8 |
position: relative; |
9 |
background-color: #d56d4d; /* layer fill content */ |
10 |
color: white; |
11 |
}
|
12 |
.hero-image { |
13 |
background: url("../images/hero_bg_image.jpg") no-repeat; |
14 |
background-size: cover; |
15 |
background-position: 50% 50%; |
16 |
position: absolute; |
17 |
top: 0; right: 0; bottom: 0; left: 0; |
18 |
opacity: .9; |
19 |
}
|
20 |
.hero-image:after { |
21 |
content: ''; |
22 |
opacity: .87; /* layer alpha */ |
23 |
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjxsaW5lYXJHcmFkaWVudCBpZD0iaGF0MCIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHgxPSIxMDAlIiB5MT0iNTAlIiB4Mj0iLTEuNDIxMDg1NDcxNTIwMmUtMTQlIiB5Mj0iNTAlIj4KPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2JiNDI0MiIgc3RvcC1vcGFjaXR5PSIxIi8+CjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2VmYWI0YSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgIDwvbGluZWFyR3JhZGllbnQ+Cgo8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgZmlsbD0idXJsKCNoYXQwKSIgLz4KPC9zdmc+); /* gradient overlay */ |
24 |
background-image: -moz-linear-gradient(right, #bb4242 0%, #efab4a 100%); /* gradient overlay */ |
25 |
background-image: -o-linear-gradient(right, #bb4242 0%, #efab4a 100%); /* gradient overlay */ |
26 |
background-image: -webkit-linear-gradient(right, #bb4242 0%, #efab4a 100%); /* gradient overlay */ |
27 |
background-image: linear-gradient(right, #bb4242 0%, #efab4a 100%); /* gradient overlay */ |
28 |
position: absolute; |
29 |
top: 0; right: 0; bottom: 0; left: 0; |
30 |
}
|
31 |
.hero h2 { |
32 |
font-size: 24px; |
33 |
}
|
34 |
|
35 |
.hero p { |
36 |
padding: 0 15%; |
37 |
}
|
38 |
.hero .separator:before { |
39 |
background-color: white; |
40 |
}
|
"Contact us" सेक्शन
"Contact us" सेक्शन दो उप-खंडों से बना है; एक बाईं तरफ के लिए, एक सही पक्ष के लिए, और बैकग्राउंड रंग के रूप में #f2f2f2
है। बाईं ओर एक 70px चारों ओर पैडिंग और एक पारदर्शी बैकग्राउंड है। आइटम के बीच एक स्थान जोड़ने के लिए सोशल लिंक्स लिस्ट की सूची तैयार की जाती है, सूची स्टाइल में कोई भी नहीं और margin-right
के लिए 10px।
form में बहुत अधिक स्टाइल नहीं है (पैडिंग के लिए 70px और एक बैकग्राउंड रंग के अलावा) क्योंकि स्केलेटन ने हमारे लिए इसके साथ काम किया है।
1 |
/*Contact*/
|
2 |
|
3 |
.contact-us { |
4 |
background-color: #f2f2f2; |
5 |
text-align: left; |
6 |
}
|
7 |
.contact-us-details { |
8 |
padding: 70px; |
9 |
}
|
10 |
.contact-us-details h5 { |
11 |
font-size: 2rem; |
12 |
}
|
13 |
.contact-us-details .social-links a { |
14 |
color: #222; |
15 |
display: block; |
16 |
}
|
17 |
|
18 |
.contact-us-details .social-links li { |
19 |
list-style: none; |
20 |
float: left; |
21 |
font-size: 24px; |
22 |
margin-right: 10px; |
23 |
}
|
24 |
.contact-us-details .social-links li:last-child { |
25 |
margin-right: 0; |
26 |
}
|
27 |
.contact-us-form { |
28 |
padding: 70px; |
29 |
background-color: #e4e4e4; |
30 |
}
|
31 |
.contact-us .row { |
32 |
margin: 0; |
33 |
}
|
कार्य सेक्शन
कार्य फिल्टर
वर्क फिल्टर मदों में font-family
के लिए "SlimJoe" है, टेक्स्ट अपरकेस, 18px फ़ॉन्ट साइज और बाएं और दाएं हाशिये के लिए 0.5 है ताकि उनके बीच का स्थान बना सके। active
स्टेट में एक अलग फ़ॉन्ट-फॅमिली, "बिग जॉन" है, जो सक्रिय होने पर बाकी मदों से अलग करता है।
1 |
/* Work Filters */
|
2 |
|
3 |
.work-filters { |
4 |
list-style: none; |
5 |
}
|
6 |
.work-filters li { |
7 |
display: inline-block; |
8 |
margin: 0 .5em; |
9 |
font-size: 18px; |
10 |
text-transform: uppercase; |
11 |
font-family: "slim_joeregular"; |
12 |
}
|
13 |
.work-filters li a { |
14 |
color: inherit; |
15 |
text-decoration: none; |
16 |
}
|
17 |
.work-filters li.active { |
18 |
font-family: "big_johnregular" |
19 |
}
|
कार्य आइटम और कार्य विवरण
कार्य आइटम्स की चौड़ाई के लिए 360px और 33% की एक निश्चित ऊंचाई है, हमें प्रत्येक पंक्ति में तीन आइटम के साथ एक ग्रिड दे। आइटम के बीच "फेक" स्थान प्रत्येक आइटम पर लागू सीमा के साथ किया जाता है।
कार्य विवरण प्रत्येक आइटम के लिए एक कैप्शन है, स्थिति के साथ पूर्ण कार्य आइटम में फैला है, और बाएं, दाएं, ऊपर और नीचे के लिए 0px। इसके पास एक बैकग्राउंड है जिसमें .75 ओपेसिटी है, ओवरले इफ़ेक्ट बनाने के बाद से यह इमेज के ऊपर है। डिफ़ॉल्ट रूप से, विवरण कंटेनर छिपा हुआ है, और जब कोई काम आइटम रखा जाता है, तो वह CSS संक्रमण के माध्यम से दृश्य-एनिमेटेड हो जाता है।
1 |
/* Work items */
|
2 |
|
3 |
.work-items { |
4 |
list-style: none; |
5 |
width: 100%; |
6 |
display: inline-block; |
7 |
}
|
8 |
.work-items li { |
9 |
position: relative; |
10 |
overflow: hidden; |
11 |
height: 360px; |
12 |
|
13 |
/* important because we need to overwrite the default skeleton */
|
14 |
margin: 0!important; |
15 |
width: 33%; |
16 |
border: 10px solid white; |
17 |
|
18 |
position: relative; |
19 |
}
|
20 |
.work-items li:nth-child(4n) { |
21 |
margin-left: 0; |
22 |
}
|
23 |
.work-items li img{ |
24 |
width: auto; |
25 |
height: 100%; |
26 |
display: block; |
27 |
}
|
28 |
/* Work detail */
|
29 |
|
30 |
.work-detail { |
31 |
position: absolute; |
32 |
top: 0; bottom: 0; left: 0; right: 0; |
33 |
|
34 |
opacity: 0; |
35 |
background: rgba(0,0,0,.75); |
36 |
color: white; |
37 |
|
38 |
-webkit-transition: all .3s ease-in-out; |
39 |
-moz-transition: all .3s ease-in-out; |
40 |
-ms-transition: all .3s ease-in-out; |
41 |
-o-transition: all .3s ease-in-out; |
42 |
transition: all .3s ease-in-out; |
43 |
}
|
44 |
.work-detail h3 { |
45 |
font-size: 16px; |
46 |
letter-spacing: .05em; |
47 |
}
|
48 |
.work-detail p { |
49 |
font-size: 20px; |
50 |
text-transform: capitalize; |
51 |
padding-left: 20px; |
52 |
padding-right: 20px; |
53 |
}
|
54 |
|
55 |
.work-items li:hover .work-detail{ |
56 |
opacity: 1; |
57 |
box-shadow: inset 0 0 0 10px #222; |
58 |
}
|
ग्राहक सेक्शन
ग्राहक सेक्शन एक सरल इनलाइन सूची है। यहाँ उल्लेख के लिए केवल एक चीज यह है कि मैं इमेजेज को desaturate करने के लिए एक grayscale CSS फिल्टर का उपयोग कर रहा हूँ। प्रत्येक वस्तु की चौड़ाई सही दूरी के लिए 18% और 2% है।
1 |
/* Clients */
|
2 |
|
3 |
.clients { |
4 |
list-style: none; |
5 |
}
|
6 |
.clients li { |
7 |
display: inline-block; |
8 |
width: 18%; |
9 |
margin-right: 2%; |
10 |
}
|
11 |
.clients li:last-child { |
12 |
margin-right: 0; |
13 |
}
|
14 |
.clients li img { |
15 |
max-width: 100%; |
16 |
height: auto; |
17 |
display: block; |
18 |
-webkit-filter: grayscale(100%); |
19 |
-moz-filter: grayscale(100%); |
20 |
filter: grayscale(100%); |
21 |
}
|
"About" सेक्शन
About सेक्शन, आइटम की ऊंचाई, 300px को छोड़कर, कार्य सेक्शन स्टाइल को प्राप्त करता है।
1 |
/* About */
|
2 |
|
3 |
.people-list { |
4 |
list-style: none; |
5 |
margin: 70px 0; |
6 |
width: 100%; |
7 |
}
|
8 |
.people-list li { |
9 |
position: relative; |
10 |
height: 300px; |
11 |
overflow: hidden; |
12 |
}
|
13 |
.people-list li img { |
14 |
width: auto; |
15 |
height: 100%; |
16 |
display: block; |
17 |
}
|
18 |
|
19 |
.people-list .people-hover { |
20 |
position: absolute; |
21 |
top: 0; bottom: 0; left: 0; right: 0; |
22 |
background: rgba(0,0,0,.45); |
23 |
|
24 |
opacity: 0; |
25 |
|
26 |
-webkit-transition: all .3s ease-in-out; |
27 |
-moz-transition: all .3s ease-in-out; |
28 |
-ms-transition: all .3s ease-in-out; |
29 |
-o-transition: all .3s ease-in-out; |
30 |
transition: all .3s ease-in-out; |
31 |
}
|
32 |
|
33 |
.people-list .people-hover a { |
34 |
position: absolute; |
35 |
top: 10px; |
36 |
right: 10px; |
37 |
color: white; |
38 |
}
|
39 |
|
40 |
/* About people details */
|
41 |
|
42 |
.people-list .people-detail { |
43 |
position: absolute; |
44 |
bottom: 0; |
45 |
width: 100%; |
46 |
text-align: center; |
47 |
padding: 0 20px; |
48 |
z-index: 1; |
49 |
color: white; |
50 |
}
|
51 |
.people-list .people-detail h3 { |
52 |
font-size: 22px; |
53 |
margin-bottom: 0; |
54 |
}
|
55 |
.people-list .people-detail p { |
56 |
font-size: 16px; |
57 |
}
|
58 |
|
59 |
.people-list li:hover .people-hover{ |
60 |
opacity: 1; |
61 |
box-shadow: inset 0 0 0 5px #222; |
62 |
}
|
सूची के अंतिम आइटम में एक अलग स्टाइल है, क्योंकि इसमें होवर इफ़ेक्ट नहीं है। बैकग्राउंड का रंग सफेद है और इसकी चारों ओर एक अलग सीमा रंग है।
1 |
/* Feature people hiring */ |
2 |
|
3 |
.people-list li.blank-feature{ |
4 |
box-shadow: inset 0 0 0 3px #222; |
5 |
} |
6 |
.people-list li.blank-feature img { |
7 |
visibility: hidden; |
8 |
} |
9 |
.people-list li.blank-feature h3 { |
10 |
font-size: 26px; |
11 |
} |
"Services" सेक्शन
Services के लिए इमेजेज 150px ऊंचाई और 20px के नीचे के मार्जिन हैं। जैसा कि आप कोड से देख सकते हैं, इमेज का एक अलग ब्लॉक प्रदर्शन और अधिकतम-चौड़ाई के लिए 100% है।
1 |
/* Services */
|
2 |
|
3 |
.services { |
4 |
list-style: none; |
5 |
margin: 70px 0; |
6 |
}
|
7 |
|
8 |
.services .service-image { |
9 |
height: 150px; |
10 |
margin-bottom: 20px; |
11 |
}
|
12 |
|
13 |
.services .service-image img{ |
14 |
display: block; |
15 |
max-width: 100%; |
16 |
margin: 0 auto; |
17 |
text-align: center; |
18 |
}
|
19 |
|
20 |
.services p { |
21 |
font-size: 16px; |
22 |
letter-spacing: 0; |
23 |
}
|
Responsiveness
चूंकि हम स्केलेटन ग्रिड प्रणाली का उपयोग कर रहे हैं, वेबसाइट बॉक्स के बाहर उत्तरदायी है, लेकिन फिर भी फ़ॉन्ट आकार, मार्जिन, पैडिंग और संरेखण के लिए कुछ स्टाइल समस्याएं हैं।
जैसा कि आप नीचे दिए गए कोड में देख सकते हैं, मोबाइल प्रदर्शित होने के लिए बटन पैडिंग छोटा है।
Tables के लिए, काम के सामान की 100% चौड़ाई होनी चाहिए और लोगों की वस्तुओं को प्रति पंक्ति दो होना चाहिए। हमें संपर्क अनुभाग फॉर्म के लिए पैडिंग को कम करने की आवश्यकता है और सामाजिक लिंक 33% चौड़ाई और केंद्र से जुड़ा होगा।
1 |
/* Media Queries |
2 |
–––––––––––––––––––––––––––––––––––––––––––––––––– */ |
3 |
|
4 |
/* Larger than mobile */ |
5 |
@media (max-width: 400px) { |
6 |
.button.inverted { |
7 |
padding: 15px; |
8 |
} |
9 |
} |
10 |
@media (min-width: 400px) and (max-width: 750px) { |
11 |
.work-items li.isotope-item.columns { |
12 |
width: 100%; |
13 |
} |
14 |
.people-list li.people-list-item.columns { |
15 |
width: 46%; |
16 |
margin: 2%; |
17 |
box-sizing: content-box; |
18 |
} |
19 |
.contact-us-details { |
20 |
padding: 70px 25px; |
21 |
text-align: center; |
22 |
} |
23 |
.contact-us-details .social-links li { |
24 |
text-align: center; |
25 |
width: 33%; |
26 |
margin: 0; |
27 |
} |
28 |
.contact-us-details h5 { |
29 |
font-size: 1.7rem; |
30 |
} |
31 |
|
32 |
} |
निष्कर्ष
यदि आप स्केलेटन फ्रेमवर्क का लाभ उठाते हैं, जैसा कि आप इस ट्यूटोरियल से देख सकते हैं, भारी काम बहुत आसानी से किया जाता है, आपको जो कुछ भी निर्माण हो रहा है उसके लिए आपको मन की शांति प्रदान करते हैं।
सच है, आपको अलग फ़ॉन्ट फॅमिली, फ़ॉन्ट सिज़ेस, spacings और, जब जरूरत पड़ती है, अलग बटन stylings लागू करने की आवश्यकता है, लेकिन इसके बारे में है।
यह इस सबक के लिए था, मुझे आशा है कि आपको इसका मज़ा आया है, और मैं आपको अगले ट्यूटोरियल में देखने के लिए उत्सुक हूं जहां हम JavaScript को लागू करेंगे। वहाँ मिलते हैं!