-
Notifications
You must be signed in to change notification settings - Fork 734
/
css2.html
587 lines (566 loc) · 23.6 KB
/
css2.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="that js dude" content="">
<title>CSS: pure css mockup</title>
<link rel="shortcut icon" href="images/favicon.jpg">
<link rel="stylesheet" href="css/bootstrap.min.css" >
<link rel="stylesheet" href="css/zenburn.css">
<!-- Custom styles for this template -->
<style>
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-bottom: 20px;
}
.purpleBold{
color:purple;
font-weight: bold;
}
.gray{
color: gray;
}
.blueish{
color: rgba(151, 182, 209, 0.98);
}
.singInStuff{
margin-top: 9px;
}
#uName{
margin-top: -7px;
}
.skipListItem{
list-style-type: none;
}
.skipListItem a{
color: inherit;
}
a:visited
{
color: rgba(218, 209, 149, 0.98);
}
.invisibleElement{
color: white;
}
/*for pure css navigation drop down*/
.myNav1 ul ul{
display: none;
}
.myNav1 ul li:hover >ul{
display: block;
}
.myNav1 ul{
list-style: none;
}
.myNav2 ul{
padding: 0;
}
.myNav2 ul li{
float: left;
}
.myNav3 ul ul li{
float: none;
}
.myNav3 ul li a{
text-decoration: none;
padding: 20px 40px;
}
.myNav4 ul{
position: relative;
}
.myNav4 ul ul {
position: absolute;
}
.myNav5 ul{
background: #efefef;
}
.myNav5 ul li:hover{
background: #4b545f;
}
.myNav ul li a{
color: #757575;
}
.myNav5 ul li:hover a{
color:#fff;
}
</style>
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>CSS: interview mock up</h1>
<h2> (part-2)</h2>
<h2>Pure css mock up for intermediate JS developer</h2>
<p>July 05, 2014</p>
<!-- <div id="fb-root"></div><div class="fb-like" data-href="http://www.thatjsdude.com/interview/css.html" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div> <div class="g-plusone"></div> -->
</div>
</div>
<div class="container">
<!-- Example row of columns -->
<div class="row center">
<!-- <iframe width="853" height="480" src="//www.youtube.com/embed/Rx_JFOSxgpY" frameborder="0" allowfullscreen></iframe> -->
</div>
<!--
<p class="gray"> <span class="purpleBold">Warning!</span>, if you have couple of tattoos in your body, this is not the right place. You certainly have more in depth knowledge, fancy portfolio and you have to express that. These questions are for lazy intermediate JS developers to get the job by creating an illusion of familiarity with css---</p> -->
<pre><code>
//header at top followed by a list of content blurbs (in this example, 4)
//media query min-width 500 px: two columns of content with spacing
// header
// content 1 content 2
// content 3 content 4
//
// text “Header” width 100% height 100px background green
// text “Content #” width 200px height 200px background red
//media query max-width 499 px: one column of content with spacing
// header
// content 1
// content 2
// content 3
// content 4
//
// text “Header” width 100% height 100px background green
// text “Content #” width 100% height 200px background blue
</code></pre>
<div>
<h2>Pure css navigation</h2>
<p><strong>Question: </strong> Can you create a navigation like the image below? Doesnt have to pretty. Don't spend more than 10min.</p>
<img src="images/layout.png">
<h4>Step-1: Create html</h4>
<p>Just create an unordered list <code><ul></ul></code> and all the menu options will be list item <code><li></li></code>. And to navigate to somewhere we will use an anchor tag <code><a></a></code>. If you have a drop down menu, then create unordered list list the list item.</p>
<pre><code>
<nav>
<ul>
<li><a href="#">JavaScript</a>
<ul>
<li><a href="#">Basic JavaScript</a></li>
<li><a href="#">Beginners Algorithm</a></li>
<li><a href="#">Dom related</a></li>
</ul>
</li>
<li><a href="#">CSS</a>
<ul>
<li><a href="#">Basic CSS questions</a></li>
<li><a href="#">Pure CSS mockup</a></li>
</ul>
</li>
<li><a href="#">HTML</a></li>
<li><a href="#">Web</a></li>
<li><a href="#">Data Structure</a>
<ul>
<li><a href="#">Linked List</a></li>
<li><a href="#">Search and Sort</a></li>
<li><a href="#">Tree</a></li>
<li><a href="#">Graph, map, vector</a></li>
</ul>
</li>
</ul>
</nav>
</code></pre>
<p><strong>output:</strong> will look like this</p>
<nav>
<ul>
<li><a href="#">JavaScript</a></li>
<ul>
<li><a href="#">Basic JavaScript</a></li>
<li><a href="#">Beginners Algorithm</a></li>
<li><a href="#">Dom related</a></li>
</ul>
<li><a href="#">CSS</a></li>
<ul>
<li><a href="#">Basic CSS questions</a></li>
<li><a href="#">Pure CSS mockup</a></li>
</ul>
<li><a href="#">HTML</a></li>
<li><a href="#">Web</a></li>
<li><a href="#">Data Structure</a></li>
<ul>
<li><a href="#">Linked List</a></li>
<li><a href="#">Search and Sort</a></li>
<li><a href="#">Tree</a></li>
<li><a href="#">Graph, map, vector</a></li>
</ul>
</ul>
</nav>
<h4>Step -2: add style</h4>
<p>We will add three style. first, take off the list style. Here we will remove the unordered list under nav. Secondly, we will hide the child content of the menu. to do this, we will call display: none for ul under ul. Third, if you hover over a list item, then display the ul under it</p>
<pre><code>
nav ul{
list-style:none;
}
nav ul ul{
display: none;
}
nav ul li:hover > ul{
display: block;
}
</code></pre>
<strong>output:</strong>
<nav class="myNav1">
<ul>
<li><a href="#">JavaScript</a>
<ul>
<li><a href="#">Basic JavaScript</a></li>
<li><a href="#">Beginners Algorithm</a></li>
<li><a href="#">Dom related</a></li>
</ul>
</li>
<li><a href="#">CSS</a>
<ul>
<li><a href="#">Basic CSS questions</a></li>
<li><a href="#">Pure CSS mockup</a></li>
</ul>
</li>
<li><a href="#">HTML</a></li>
<li><a href="#">Web</a></li>
<li><a href="#">Data Structure</a>
<ul>
<li><a href="#">Linked List</a></li>
<li><a href="#">Search and Sort</a></li>
<li><a href="#">Tree</a></li>
<li><a href="#">Graph, map, vector</a></li>
</ul>
</li>
</ul>
</nav>
<h4>Step -3: add more style</h4>
<p>The first problem, we have there is things are offset from the left. So, we will add padding 0 for ul. In a menu items at the root of the menu are styled side by side in a horizontal level. Hence, we will add float left for all the list item under unordered list.</p>
<pre><code>
nav ul{
padding: 0;
}
nav ul li{
float: left;
}
</code></pre>
<strong>output:</strong>
<div>
<nav class="myNav1 myNav2">
<ul>
<li><a href="#">JavaScript</a>
<ul>
<li><a href="#">Basic JavaScript</a></li>
<li><a href="#">Beginners Algorithm</a></li>
<li><a href="#">Dom related</a></li>
</ul>
</li>
<li><a href="#">CSS</a>
<ul>
<li><a href="#">Basic CSS questions</a></li>
<li><a href="#">Pure CSS mockup</a></li>
</ul>
</li>
<li><a href="#">HTML</a></li>
<li><a href="#">Web</a></li>
<li><a href="#">Data Structure</a>
<ul>
<li><a href="#">Linked List</a></li>
<li><a href="#">Search and Sort</a></li>
<li><a href="#">Tree</a></li>
<li><a href="#">Graph, map, vector</a></li>
</ul>
</li>
</ul>
</nav>
</div>
<p class="">Content Below 1</p>
<p class="">Content Below 2</p>
<h4>Step -4: add more style</h4>
<p>Now will solve two problem. Most important problem is, As the menu item is sitting next to each other </p>
<pre><code>
nav ul ul li{
float: none;
}
nav ul li a{
padding: 20px 40px;
}
</code></pre>
<strong>output:</strong>
<div>
<nav class="myNav1 myNav2 myNav3">
<ul>
<li><a href="#">JavaScript</a>
<ul>
<li><a href="#">Basic JavaScript</a></li>
<li><a href="#">Beginners Algorithm</a></li>
<li><a href="#">Dom related</a></li>
</ul>
</li>
<li><a href="#">CSS</a>
<ul>
<li><a href="#">Basic CSS questions</a></li>
<li><a href="#">Pure CSS mockup</a></li>
</ul>
</li>
<li><a href="#">HTML</a></li>
<li><a href="#">Web</a></li>
<li><a href="#">Data Structure</a>
<ul>
<li><a href="#">Linked List</a></li>
<li><a href="#">Search and Sort</a></li>
<li><a href="#">Tree</a></li>
<li><a href="#">Graph, map, vector</a></li>
</ul>
</li>
</ul>
</nav>
</div>
<p class="">Content Below 1</p>
<p class="">Content Below 2</p>
<p class="">Content Below 3</p>
<p class="">Content Below 4</p>
<div>
<h4>Step -5: add more style</h4>
<p>To avoid forcing content below. you have to apply two rules. First, make ul under nav to be positioned as relative. second, make ul under ul (which contains sub menu items), to be positioned relative</p>
<p>Now, sub menu will not be forced below.</p>
<pre><code>
nav ul{
position: relative;
}
nav ul ul {
position: absolute;
}
</code></pre>
<strong>output:</strong>
<div>
<nav class="myNav1 myNav2 myNav3 myNav4">
<ul>
<li><a href="#">JavaScript</a>
<ul>
<li><a href="#">Basic JavaScript</a></li>
<li><a href="#">Beginners Algorithm</a></li>
<li><a href="#">Dom related</a></li>
</ul>
</li>
<li><a href="#">CSS</a>
<ul>
<li><a href="#">Basic CSS questions</a></li>
<li><a href="#">Pure CSS mockup</a></li>
</ul>
</li>
<li><a href="#">HTML</a></li>
<li><a href="#">Web</a></li>
<li><a href="#">Data Structure</a>
<ul>
<li><a href="#">Linked List</a></li>
<li><a href="#">Search and Sort</a></li>
<li><a href="#">Tree</a></li>
<li><a href="#">Graph, map, vector</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
<p>Content Below 1</p>
<p>Content Below 2</p>
<p>Content Below 3</p>
<p>Content Below 4</p>
<div>
<h4>Step - 6: put some color</h4>
<p>To avoid forcing content below. you have to apply two rules. First, make ul under nav to be positioned as relative. second, make ul under ul (which contains sub menu items), to be positioned relative</p>
<p>Now, sub menu will not be forced below.</p>
<pre><code>
nav ul{
background: #efefef;
}
nav ul li:hover{
background: #4b545f;
}
nav ul li a{
color: #757575;
}
nav ul li:hover a{
color:#fff;
}
</code></pre>
<strong>output:</strong>
<div>
<nav class="myNav1 myNav2 myNav3 myNav4 myNav5">
<ul>
<li><a href="#">JavaScript</a>
<ul>
<li><a href="#">Basic JavaScript</a></li>
<li><a href="#">Beginners Algorithm</a></li>
<li><a href="#">Dom related</a></li>
</ul>
</li>
<li><a href="#">CSS</a>
<ul>
<li><a href="#">Basic CSS questions</a></li>
<li><a href="#">Pure CSS mockup</a></li>
</ul>
</li>
<li><a href="#">HTML</a></li>
<li><a href="#">Web</a></li>
<li><a href="#">Data Structure</a>
<ul>
<li><a href="#">Linked List</a></li>
<li><a href="#">Search and Sort</a></li>
<li><a href="#">Tree</a></li>
<li><a href="#">Graph, map, vector</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
<h4>End</h4>
<p> ref: <a href="http://line25.com/tutorials/how-to-create-a-pure-css-dropdown-menu">create pure css</a> <a href="http://cssdeck.com/labs/pure-css3-smooth-drop-down-menu">Extra one</a></p>
</div>
<div>
<h2>psd to mockup</h2>
<li>follow this video serios of <a href="http://css-tricks.com/video-screencasts/1-converting-a-photoshop-mockup-part-1-of-3/">css tricks</a></li>
</div>
<div>
<h2>create mock</h2>
<img src="images/interview_mock.png">
</div>
<div>
<h2>create another mock</h2>
<img style="width:70%; height:50%" src="images/layout2.png">
<p>Will have left and right panel. and you will have floated elements inside it left side name and text and the right side number of likes</p>
</div>
<div>
<h2>little higher level</h2>
<img style="width:70%; height:50%" src="images/layout3.png">
<p>floated items inside floated times and two sides</p>
<p>left side will be 200px and right side will be rest of the page and in terms of percentage</p>
</div>
<div>
<h2>three column layout and width related problem</h2>
<p>search for it or at least try to make something up</p>
</div>
<div>
<h2>create a button like css tricks interview</h2>
<p><a href="http://css-tricks.com/interview-questions-css/">link for css tricks</a> and there you will find so many solutions. learn it and put it here</p>
</div>
<div class="bg-danger">
<h2>Don't worry about the questions here</h2>
<p>this is only for developing layout from css</p>
</div>
<h3>List of Questions</h3>
<ol>
<li><a href="http://www.instantshift.com/2010/03/15/47-css-tips-tricks-to-take-your-site-to-the-next-level/"> very good 47 css tips and tricks</a></li>
<li>How do u center hotizontal center</li>
<li>vertical centering text with line height</li>
<li>vetical center of block level layout</li>
<li>link style order</li>
<li>min height fix for IE (14)</li>
<li>How to set base font size (15)</li>
<li>how to do drop caps by css</li>
<li>setting padding on background image/ stretching (23, 24)</li>
<li>use image a list bullets(26)</li>
<li>swap background image on hover</li>
<li>basic 3 column layout (33)</li>
<li>prevent line break</li>
<li>create circles with border radius (45)</li>
<li>css tooltips</li>
<li>ref: <a href="http://www.delimited.io/blog/2014/6/17/force-directed-graphs-in-d3">Force directed graph in d3</a></li>
<li><a href="http://fortysevenmedia.com/blog/archives/making_your_footer_stay_put_with_css/">Making your footer saty at foot with css</a></li>
<li><a href="http://blog.themeforest.net/tutorials/vertical-centering-with-css/">five ways of vertical centering</a></li>
<li><a href="http://24ways.org/2008/making-modular-layout-systems/">making modular layout</a></li>
<li><a href="">bar chart with css (ggl it)</a></li>
<li><a href="http://www.1stwebdesigner.com/css/advanced-css-text-effects-web-typography-tips/">22 advanced css text effect</a></li>
<li><a href="http://www.sitepoint.com/12-little-known-css-facts">css 12 little known facts</a></li>
<li><a href="http://alistapart.com/article/css-shapes-101">css shapes</a></li>
</ol>
<li>write a simple slide show page. bonus is not to use any css</li>
<li>how css box model will defer </li>
<li>How would a serve a html file in multiple language</li>
<li>what are the building blocks of html5</li>
<h2>References</h2>
<ul>
<li><a href="http://blog.themeforest.net/general/15-css-tricks-that-must-be-learned/">15 css tricks (just read it)</a></li>
<li><a href="">css tricks special button. Practice it</a></li>
<li><a href="http://alistapart.com/article/css-shapes-101">Css Shapes 101. read it</a></li>
</ul>
good site design:
<ol>
<li><a href="http://www.christopher-ware.com/">christoper ware</a></li>
</ol>
<div>
<h2>other questions</h2>
<ol>
<li><a href="http://www.pixelbind.com/make-a-div-stick-when-you-scroll/">make a div follow when u scroll</a></li>
<li>two column on fixed another fluid <a href="http://stackoverflow.com/questions/5195836/2-column-div-layout-right-column-with-fixed-width-left-fluid">check this </a> or <a href="http://radiatingstar.com/make-a-layout-with-fluid-and-fixed-size-columns">another example</a></li>
<li>how quirks mode changes css box model</li>
<li>why quirks mode is used</li>
<li>what are the problem of quirk mode in old browser. may be FOUC (flash of unstyled content). most likely happens with old IE</li>
<li>why inline elementd dont have width</li>
<li>How you increase performance of your css</li>
<li></li>
<li>How will you make a website response </li>
<li>If you want to make a website responsive, you will you start</li>
<li>how will you start when you have to make a site compatible to different browser</li>
</ol>
</div>
<div>
<h2>Floats and computed height</h2>
<h4>will help in interview</h4>
<p>A parent element that has only floated content will have a computed height: 0;. Add a clearfix to the parent to force browsers to compute a height.</p>
<p>ref: <a href="http://wtfhtmlcss.com/"> wtf css (get others)</a></p>
</div>
<h3>Deleted Scenes!</h3>
<p class="gray">Looks like these are for hardcore designer folks. Hence, didn't make in for developers.</p>
<ul>
</ul>
<p><strong>Need more:</strong> <strong><a href="html.html">HTML Interview Questions</a></strong>, <strong><a href="js1.html">JavaScript Beginners Algorithm</a></strong></p>
<div>
</div>
<p><strong>Need more:</strong> <strong><a href="html.html">HTML Interview Questions</a></strong>, <strong><a href="js1.html">JavaScript Beginners Algorithm</a></strong></p>
<p><a href="http://www.sitepoint.com/12-little-known-css-facts/">12 little known css facts</a></p>
<p><a href="http://alistapart.com/article/css-shapes-101">css shapes 101</a></p>
<div>
<h3 class="purpleBold">Express anger!</h3>
<!-- <p class="gray">Feel free to express your anger (sorry folks, you have to use g+.). Also point out my mistakes ( technical, wrong answer, spelling, grammar, sentence..., whatever), let your dude learn and grow.</p>
<script src="https://apis.google.com/js/plusone.js"></script>
<div class="g-comments"
data-href="http://www.thatjsdude.com/interview/css2.html"
data-width="642"
data-first_party_property="BLOGGER"
data-view_type="FILTERED_POSTMOD">
</div> -->
</div>
<hr>
<footer>
<p>©thatJSDude 2014</p>
</footer>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery-2.0.3.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="js/toggleExample.js"></script>
<script type="text/javascript">
// //social plugins
// //g+
// (function() {
// var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
// po.src = 'https://apis.google.com/js/platform.js';
// var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
// })();
// //fb
// (function(d, s, id) {
// var js, fjs = d.getElementsByTagName(s)[0];
// if (d.getElementById(id)) return;
// js = d.createElement(s); js.id = id;
// js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
// fjs.parentNode.insertBefore(js, fjs);
// }(document, 'script', 'facebook-jssdk'));
</script>
</body>
</html>