You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css.html
+85-81Lines changed: 85 additions & 81 deletions
Original file line number
Diff line number
Diff line change
@@ -311,8 +311,13 @@ <h2>6. display vs visibility</h2>
311
311
<p>if u want to say it smartly, <code>display:none</code> cuases DOM reflow where is <code>visibility:hidden</code> doesn't. btw, what is reflow? answer. sorry i wont tell you, google it.</p>
312
312
<p>ref: <ahref="http://www.vanseodesign.com/css/visibility-vs-display/">visibility vs Display</a></p>
313
313
</div>
314
+
<divid="inline_block">
315
+
<h2>7. inline block</h2>
316
+
<p><strong>Question:</strong> What are the differences between inline, block and inline-block</p>
317
+
<p><strong>Answer: </strong></p>
318
+
</div>
314
319
<divid="mark">
315
-
<h2>7. box model</h2>
320
+
<h2>8. box model</h2>
316
321
<p><strong>Question:</strong> What are the properties related to box model?</p>
317
322
<p><strong>Answer:</strong> everything in a web page is a box where you can control size, position, background, etc. Each box/content area is optionally surrounded by padding, border and margin. When you set height and width of an element, you set content height and width.</p>
318
323
<p>Technically, height, width, padding and border are part of box model and margin is related to it.</p>
@@ -325,51 +330,8 @@ <h2>7. box model</h2>
325
330
</div>
326
331
</div>
327
332
</div>
328
-
<divid="http_request">
329
-
<h2>8. specificity </h2>
330
-
<p><strong>Question:</strong> What is specificity? How do u calculate specificity?</p>
331
-
<p><strong>Answer:</strong> is a process of determining which css rule will be applied to an element. it actually determines which rules will take precedence. </p>
332
-
<p>inline style usually wins then ID then class value (or pseudo-class or attribute selector), unversal selector (*) has no specificity.</p>
333
-
<p>ref: <ahref="http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/">css specificity: things you need to know</a>, <ahref="http://www.standardista.com/css3/css-specificity/">specifishity</a>, <ahref="http://specificity.keegan.st/">specificiyt calculator</a></p>
334
-
</div>
335
-
<divid="standard_quirks">
336
-
<h2>9. shadow DOM</h2>
337
-
<p><strong>Question:</strong> What is shadow DOM?</p>
338
-
<p><strong>Answer:</strong> encapsulate part of a DOM. hide subtree. you can have same ID in different shadow DOM. Polymers uses it. This way your DOM becomes reusable and u dont have to do iframe. if interviewer is not happy with your answer give him the links and tell him to spend a weekend on reading.</p>
<p><strong>Question:</strong> What do u know about tranisition?</p>
344
-
<p><strong>Answer:</strong> transition allows to add an effect while changing from one style to another. You can set the which property you want to transition, duration, how u want to transit (linear, ease, ease-in, ease-out, cubic-bezier) and delay when transition will start. you can transition more than one property by comma seperation</p>
transition: width 2s linear 0.5s, background-color 2s linear 0.5s;
356
-
}
357
-
358
-
.element:hover {
359
-
width: 100px;
360
-
background-color:red;
361
-
}
362
-
</code></pre>
363
-
<p>Hover over the purple box and wait.</p>
364
-
<divclass="element"></div>
365
-
<p><strong>Advanced:</strong> you can check transfrom: <ahref="http://www.sitepoint.com/advanced-css3-2d-and-3d-transform-techniques/">css 2D 3D transform</a>, <ahref="http://css3.bradshawenterprises.com/flip/">flip an image</a></p>
366
-
</div>
367
-
</div>
368
-
<p>ref: <ahref="http://blog.alexmaccaw.com/css-transitions">all you need to know about css transition</a>, <ahref="http://css3.bradshawenterprises.com/transitions/">transition: tutorial</a>, <ahref="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions">css transition</a>, <ahref="http://www.html5rocks.com/en/tutorials/3d/css/">transition and 3D</a></p>
369
-
370
-
</div>
371
333
<divid="svg_canvas">
372
-
<h2>11. overflow</h2>
334
+
<h2>9. overflow</h2>
373
335
<p><strong>Question:</strong> Does overflow: hidden create a new block formatting context?</p>
374
336
<p><strong>Answer:</strong> yes</p>
375
337
<p><strong>Extra:</strong> overflow property deals with the content if content size exceeds the allocated size for the content. You can make extra content visible, hidden, scroll or auto (viewport default behavior).</p>
@@ -397,7 +359,7 @@ <h2>11. overflow</h2>
397
359
</div>
398
360
399
361
<divid="div_section_article">
400
-
<h2>12. media queries</h2>
362
+
<h2>10. media queries</h2>
401
363
<p><strong>Question:</strong> How could you apply css rules specific to a media?</p>
402
364
<p><strong>Answer: </strong><code>@media (max-width:700px){...}</code> means you want to apply rules to those media whose max-width is 700 px. this means every samller device will have this rule.</p>
403
365
<p><code>@media (max-width:700px) and (orientation: landscape){...}</code> will apply rules for media smaller than 700px and in landscape orientation.</p>
@@ -408,7 +370,7 @@ <h2>12. media queries</h2>
408
370
<p>ref: <ahref="http://mobile.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/">how to use media queries</a>, <ahref="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries">css media queries</a>, <ahref="http://www.w3.org/TR/css3-mediaqueries/#media0">W3: media queries</a></p>
409
371
</div>
410
372
<divid="div_span">
411
-
<h2>13. pseudo class</h2>
373
+
<h2>11. pseudo class</h2>
412
374
<p><strong>Question:</strong> What are the some peseudo classed u have used?</p>
413
375
<p><strong>Answer: </strong> pseudo class tells you specific state of an element. allow to style element dynamically. The most popular one is <code>:hover</code>. Besides i have used <code>:visited</code>, <code>:focus</code>, <code>:nth-child</code>, <code>nth-of-type</code>, <code>:link</code>, etc.</p>
414
376
<p>pseudo classes is better if you dont want to mess up with javascript however, pesudo-classes is slow to process and apply rules.</p>
<p><strong>Question:</strong> How do you optimize css selectors?</p>
434
-
<p><strong>Answer: </strong> This is very open and depend on what you are trying to achieve. If i order selectors interms of render speed it would be like id, class, tag, siblings, child, descendent, universal, attribute, pseudo. Speed of ID and class is very close. However your code should be readable, maintainable and DRY along with highly performant.</p>
435
-
<p>The best practices in general are: avoid universal selectors, don't repeat yourself, remove redundant selectors, be as specific as possible, and keep learning.</p>
<p><strong>Question:</strong> What are the different css filter you can use?</p>
441
-
<p><strong>Answer:</strong> css filter allows u to render DOM element, image, or video. u can choose from: grayscale, blur, opacity, brightness, contrast.</p>
<p><strong>Question:</strong> How can you load css resources conditionally?</p>
458
-
<p><strong>Answer:</strong> @import allows you to load/import stylesheet by using a prth (uri) representing the location of the file. You can define one or more media by comma seperation for which you want to load the stylesheet. If browser dont support the media stylesheet will not be loaded.</p>
459
-
<p>ref: be careful while using @import (<ahref="http://www.stevesouders.com/blog/2009/04/09/dont-use-import/">don't use @import</a>)</p>
460
-
</div>
461
-
<divid="something">
462
-
<h2>17. vertical Center</h2>
394
+
<h2>12. vertical Center</h2>
463
395
<p><strong>Question:</strong> How do you align a p center-center inside a div?</p>
464
396
<p><strong>Answer:</strong><code>text-align:center</code>will do the horizontal alignment but <code>vertical-laign:middle</code> will not work here. there are couple of different ways to solve this problem and one of them are positioning. You make the parent as relative position and child as absolute positioning. And then define all position parameter as sero and width 50% and height 30% (sounds messy look at the example and read ref) </p>
<p>ref: <ahref="http://www.vanseodesign.com/css/vertical-centering/">6 methods for vertical center</a>, <ahref="http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/">Absolute horizontal and vertical centering</a></p>
478
410
</div>
479
411
<divid="something">
480
-
<h2>18. sprite</h2>
412
+
<h2>13. optimize selector</h2>
413
+
<p><strong>Question:</strong> How do you optimize css selectors?</p>
414
+
<p><strong>Answer: </strong> This is very open and depend on what you are trying to achieve. If i order selectors interms of render speed it would be like id, class, tag, siblings, child, descendent, universal, attribute, pseudo. Speed of ID and class is very close. However your code should be readable, maintainable and DRY along with highly performant.</p>
415
+
<p>The best practices in general are: avoid universal selectors, don't repeat yourself, remove redundant selectors, be as specific as possible, and keep learning.</p>
<p><strong>Question:</strong> How can you load css resources conditionally?</p>
421
+
<p><strong>Answer:</strong> @import allows you to load/import stylesheet by using a prth (uri) representing the location of the file. You can define one or more media by comma seperation for which you want to load the stylesheet. If browser dont support the media stylesheet will not be loaded.</p>
422
+
<p>ref: be careful while using @import (<ahref="http://www.stevesouders.com/blog/2009/04/09/dont-use-import/">don't use @import</a>)</p>
423
+
</div>
424
+
<divid="something">
425
+
<h2>15. sprite</h2>
481
426
<p><strong>Question:</strong> Why would you use sprites?</p>
482
427
<p><strong>Answer:</strong> When you have multiple images/icons, browser makes seperate call to the server for each one of them. sprite is a technique to combine all of them (usually similar one in terms of type of image. For example, you will put jpg in one sprite) in one image. you can later optimize the image. To display the icon you set height, width and background position.</p>
483
428
<p>popular libraries like bootstrap use this technques. If you repeat the image. want to scale you have to be careful with sprite.</p>
<p><strong>Question:</strong> What is specificity? How do u calculate specificity?</p>
434
+
<p><strong>Answer:</strong> is a process of determining which css rule will be applied to an element. it actually determines which rules will take precedence. </p>
435
+
<p>inline style usually wins then ID then class value (or pseudo-class or attribute selector), unversal selector (*) has no specificity.</p>
436
+
<p>ref: <ahref="http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/">css specificity: things you need to know</a>, <ahref="http://www.standardista.com/css3/css-specificity/">specifishity</a>, <ahref="http://specificity.keegan.st/">specificiyt calculator</a></p>
437
+
</div>
438
+
<divid="standard_quirks">
439
+
<h2>17. shadow DOM</h2>
440
+
<p><strong>Question:</strong> What is shadow DOM?</p>
441
+
<p><strong>Answer:</strong> encapsulate part of a DOM. hide subtree. you can have same ID in different shadow DOM. Polymers uses it. This way your DOM becomes reusable and u dont have to do iframe. if interviewer is not happy with your answer give him the links and tell him to spend a weekend on reading.</p>
<p><strong>Question:</strong> What do u know about tranisition?</p>
447
+
<p><strong>Answer:</strong> transition allows to add an effect while changing from one style to another. You can set the which property you want to transition, duration, how u want to transit (linear, ease, ease-in, ease-out, cubic-bezier) and delay when transition will start. you can transition more than one property by comma seperation</p>
transition: width 2s linear 0.5s, background-color 2s linear 0.5s;
459
+
}
460
+
461
+
.element:hover {
462
+
width: 100px;
463
+
background-color:red;
464
+
}
465
+
</code></pre>
466
+
<p>Hover over the purple box and wait.</p>
467
+
<divclass="element"></div>
468
+
<p><strong>Advanced:</strong> you can check transfrom: <ahref="http://www.sitepoint.com/advanced-css3-2d-and-3d-transform-techniques/">css 2D 3D transform</a>, <ahref="http://css3.bradshawenterprises.com/flip/">flip an image</a></p>
469
+
</div>
470
+
</div>
471
+
<p>ref: <ahref="http://blog.alexmaccaw.com/css-transitions">all you need to know about css transition</a>, <ahref="http://css3.bradshawenterprises.com/transitions/">transition: tutorial</a>, <ahref="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions">css transition</a>, <ahref="http://www.html5rocks.com/en/tutorials/3d/css/">transition and 3D</a></p>
472
+
</div>
473
+
<divid="filter">
474
+
<h2>19. filter</h2>
475
+
<p><strong>Question:</strong> What are the different css filter you can use?</p>
476
+
<p><strong>Answer:</strong> css filter allows u to render DOM element, image, or video. u can choose from: grayscale, blur, opacity, brightness, contrast.</p>
<p><strong>Question:</strong> What are the reasons to use preprocessor?</p>
489
493
<p><strong>Answer:</strong> you write css in high level with some special syntax (declaring variable, nested syntax, mathmetical operations, etc.) and that is compiled to css. Preprocessor helps you to speed up develop, maintain, ensure best practices and also confirms concatenation, compression, etc.</p>
490
494
491
495
ref: <ahref="http://css-tricks.com/musings-on-preprocessing/">css preprocessor</a>, <ahref="https://developers.google.com/chrome-developer-tools/docs/css-preprocessors">working with preprocessor</a>
492
496
</div>
493
497
<divid="download_order">
494
-
<h2>20. show & tell</h2>
498
+
<h2>21. show & tell</h2>
495
499
<p><strong>Question:</strong> What is the color of text sausage for he following rule?</p>
0 commit comments