Building a Website #Day5.2
Skills:
HTML & CSS90%
Key Takeaways
Builds a website header with CSS-only sidenav and SVG using frontend engineering techniques
Full Transcript
right we've got some visual progress finally we got something on the screen that is actually uh a thing to look at and actually um even this little header here has presented some interesting um side challenges um mostly around what to do with mobile let me show you what it does as the screen gets bigger and smaller there we go we are so a small sort of 3 20ish pixel wide which is what you'd find on an iPhone um it looks like that at the moment uh it has the little you know the little menu thing going on and then as the space kind of grows you get the actual sections and you can you know click around and all the rest of it and the little the thing is this little side nav here um when you click on it pop pops out like that but that's all done without JavaScript um and you can toggle it like that and so on uh so the way that I've done that is a little uh so I'm not the first person to to to do this in fact if you Google it there are plenty of people who do similar things what we've got here is uh a label and the label is connected to a checkbox and so when you click on the label it basically toggles the checkbox state to from checked and not checked and then um the menu is styled that you can see here if the checkbox is checked uh and you I'm using the general sibling selector tell them the nav to be display block and all the rest of it um and so you can basically by toggling the check boox you're actually toggling the visibility of the menu no JavaScript and now what I'm going to do is when I get to adding in the JavaScript to the site I'm going to progressively enhance that to something that slides in and out is my plan because while that works it's not the nicest for it to just appear I'd like it to slide in and out but this is actually it's working just fine the the thing that um you'll notice when you look at uh blogposts or or stack Overflow ansers that that mention doing something like this um is that they um they will set the the checkbox to display nonone and I didn't want to set the checkbox to display none because it so I can click on this if you look I can click on it um but I wanted to maintain uh keyboard control and I need to put in a focus State actually so when I when I see this video if I haven't done it already I want to add a focus State onto back onto that so that it's very clear that it has Focus because I think we want that but the reason um I didn't want to set um you can see the check boox there I the reason I didn't want to set the display nonone on the check boox itself is because you lose the ability to do keyboard shortcut uh the keyboard control so right now I I hit if I say if it's got focus by clicking on the label I give it focus and I can t I can still tap to it if I set this look if I set this to display nonone I can still click on it but I can't hit space bar anymore no amount of space bar is going to make that go away somebody who's got a desire to use the keyboard is going to get frustrated with that so I figure there's no harm to having it display but opacity zero it seems to give me uh the best combination of those two and because the the the label isn't um uh tabbable I'm hoping that that's the correct combination of things I need to check with Alice boxall or Rob Dodson uh to just help me make sure that I've definitely done that right but anyway that's the that's the side nav um and obviously disappears and so on so that's just a lot of CSS media break pointy type stuff um and there is this slight um curve on the head or the slight angle which is done with a an SVG and let me show you that since we're here looking at this header uh it looks like that and it basically like that sort of scales across based on that so it's because it's got preserve aspect ratio non um and it's just width 100% height 100% basically whatever div I give it to it's going to stretch to fill uh [Music] get your voice right Paul okay um it's going to stretch to fill up that uh element so that works out just fine actually um that's giving me the kind of look that I wanted to to have so there we are um a CSS only um side nav which is doing just fine we can click around we're in the location schedule and so on so making a little bit of progress there um and a couple of interesting little things along the way Grand don't forget to subscribe don't forget to keep dropping in the comments and uh ideas thoughts suggestions all the above uh and I will of course probably catch you in the next one [Music]
Original Description
Things are getting a little more visual: the header has arrived, complete with CSS-only, keyboard-navigable sidenav and a little SVG to give it and angular look.
See the source code: https://goo.gl/6Dwwrs
Subscribe to the Chrome Developers Channel: http://goo.gl/LLLNvf
Check out the playlist: https://goo.gl/cbQTWK
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Chrome for Developers · Chrome for Developers · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Polymer Performance Patterns (The Polymer Summit 2015)
Chrome for Developers
Polymer Power Tools (The Polymer Summit 2015)
Chrome for Developers
Chrome Dev Summit 2014 – Chrome Case Studies
Chrome for Developers
Web Directions Code 2015 round up
Chrome for Developers
Maintainable Code - HTTP203
Chrome for Developers
iron-ajax… wat?! -- Polycasts #26
Chrome for Developers
The Guardian - Supercharged
Chrome for Developers
ES2015 (next version of JavaScript), Totally Tooling Tips (S2 Ep1)
Chrome for Developers
#AskPolymer: Rob answers all the questions ever -- Polycasts #27
Chrome for Developers
The Future of JavaScript - HTTP203
Chrome for Developers
Data Binding 101 -- Polycasts #28
Chrome for Developers
The Guardian part 2 - Supercharged
Chrome for Developers
The Future of Web Audio: with Chris Wilson and Chris Lowis
Chrome for Developers
Chrome 46: New motion-path animations, client hints and service worker improvements
Chrome for Developers
Sublime Snippets, Totally Tooling Tips (S2 Ep2)
Chrome for Developers
#AskPolymer: How do you make the show? -- Polycasts #29
Chrome for Developers
Critical Path CSS, Totally Tooling Tips (S2 Mini Tip #1)
Chrome for Developers
Binding to Objects -- Polycasts #30
Chrome for Developers
Player FM - Supercharged
Chrome for Developers
Where’s the Designer? #AskPolymer -- Polycasts #31
Chrome for Developers
Jake Beats Wikipedia - HTTP203
Chrome for Developers
Supercharged Observers! -- Polycasts #32
Chrome for Developers
Jai's Web blog - Supercharged
Chrome for Developers
Windows Command-line Tooling, Totally Tooling Tips (S2, Ep4)
Chrome for Developers
What about internationalization? #AskPolymer -- Polycasts #33
Chrome for Developers
Developing for Billions (Chrome Dev Summit 2015)
Chrome for Developers
Google+ Performance Improvement Comparison
Chrome for Developers
Deploying HTTPS: The Green Lock and Beyond (Chrome Dev Summit 2015)
Chrome for Developers
Progressive Web Apps (Chrome Dev Summit 2015)
Chrome for Developers
Instant Loading with Service Workers (Chrome Dev Summit 2015)
Chrome for Developers
Increase Engagement with Web Push Notifications (Chrome Dev Summit 2015)
Chrome for Developers
Engaging with the Real World: Web Bluetooth and Physical Web (Chrome Dev Summit 2015)
Chrome for Developers
Asking for Permission: respectful, opinionated UI (Chrome Dev Summit 2015)
Chrome for Developers
Polymer - State of the Union (Chrome Dev Summit 2015)
Chrome for Developers
Building Progressive Web Apps with Polymer (Chrome Dev Summit 2015)
Chrome for Developers
Introduction to RAIL (Chrome Dev Summit 2015)
Chrome for Developers
DevTools in 2015: Authoring to the max (Chrome Dev Summit 2015)
Chrome for Developers
RAIL in the real world (Chrome Dev Summit 2015)
Chrome for Developers
#ChromeDevSummit talks are up - W00T! -- Polycast #34
Chrome for Developers
V8 Performance from the Driver's Seat (Chrome Dev Summit 2015)
Chrome for Developers
Quantify and improve real-world RAIL (Chrome Dev Summit 2015)
Chrome for Developers
Owning your performance: RAIL (Chrome Dev Summit 2015)
Chrome for Developers
HTTP/2 101 (Chrome Dev Summit 2015)
Chrome for Developers
Leadership Panel (Chrome Dev Summit 2015)
Chrome for Developers
Build Processes, Totally Tooling Tips (S2, Ep 5)
Chrome for Developers
Accessibility (Chrome Dev Summit 2015)
Chrome for Developers
Binding to Arrays -- Polycasts #35
Chrome for Developers
HTTP2 - HTTP203
Chrome for Developers
Chrome 47: Splash Screens, requestIdleCallback and better desktop notifications (New in Chrome)
Chrome for Developers
Call For Submissions - Supercharged
Chrome for Developers
Cross Device Testing, Totally Tooling Tips (S2 Ep6)
Chrome for Developers
Testing AJAX with Web Component Tester -- Polycasts #37
Chrome for Developers
Slack: Extended Xmas Special - Supercharged
Chrome for Developers
Browser testing with Travis & Sauce Labs -- Polycasts #38
Chrome for Developers
Optimize for production with Vulcanize -- Polycasts #39
Chrome for Developers
Highlights from Chrome Dev Summit 2015
Chrome for Developers
Chrome 48: Custom buttons in notifications, DevTools Security panel, and Presentation mode
Chrome for Developers
Crisper: Protecting your Polymer app with CSP -- Polycasts #40
Chrome for Developers
How do I use Sass with Polymer? #AskPolymer -- Polycasts #41
Chrome for Developers
Colors – DevTools Tonight #0 (Pilot)
Chrome for Developers
More on: HTML & CSS
View skill →Related Reads
📰
📰
📰
📰
Inside the Wayfair Frontend SDE-2 Interview: A Complete Breakdown
Medium · Programming
I Spent Two Years Maintaining a React SPA. HTMX Rebuilt It in a Week
Medium · Programming
The 5 Levels of Front End Engineering (And Where Most Developers Get Stuck)
Medium · Programming
Browser-Based PDF Editing with Vue 3 and pdf-lib
Dev.to · sunshey
🎓
Tutor Explanation
DeepCamp AI