|
32 | 32 | .skipListItem{ |
33 | 33 | list-style-type: none; |
34 | 34 | } |
| 35 | + /*style for demo*/ |
| 36 | + .floatContainer{ |
| 37 | + width: 200px; |
| 38 | + height: 100px; |
| 39 | + border: 2px solid purple; |
| 40 | + } |
| 41 | + .box{ |
| 42 | + float: left; |
| 43 | + width:50px; |
| 44 | + height: 30px; |
| 45 | + border: 2px solid gray; |
| 46 | + margin:5px; |
| 47 | + } |
35 | 48 | </style> |
36 | 49 |
|
37 | 50 | <!-- Just for debugging purposes. Don't actually copy this line! --> |
@@ -85,20 +98,28 @@ <h2>1. float</h2> |
85 | 98 | <p><strong>Question:</strong> How float works?</p> |
86 | 99 | <p><strong>Answer:</strong> float is to push element on a side of a page with text wrap around it. you can create entire page or litter area by using float. if size of a floated element changes, text around it will reflow to accomodate the changes. You can have float left, right, none or inherit.</p> |
87 | 100 | <p> if you set, 'float: left;' for an image, it will move to the left until the margin, padding or border of another block-level element is reached. The normal flow will wrap around on the right side.</p> |
88 | | - |
| 101 | + <pre><code> |
| 102 | + <style><br/> .floatContainer{<br/> width: 200px;<br/> height: 100px;<br/> border: 2px solid purple;<br/> }<br/> .box{<br/> float: left;<br/> width:50px;<br/> height: 30px;<br/> border: 2px solid gray;<br/> margin:5px;<br/> }<br/> </style> |
| 103 | + <div class="container"><br/> <div class="box"><span>1</span></div><br/> <div class="box"><span>2</span></div><br/> <div class="box"><span>3</span></div><br/> <div class="box"><span>4</span></div><br/> <div class="box"><span>5</span></div><br/> </div> |
| 104 | + </code></pre> |
| 105 | + <div class="floatContainer"> |
| 106 | + <div class="box"><span>1</span></div> |
| 107 | + <div class="box"><span>2</span></div> |
| 108 | + <div class="box"><span>3</span></div> |
| 109 | + <div class="box"><span>4</span></div> |
| 110 | + <div class="box"><span>5</span></div> |
| 111 | + </div> |
89 | 112 | <p>If interviewer wants to ask one question about css, that would be most likely about float</a>.</p> |
90 | 113 | <p><strong>extra:</strong> read the positioning constraints in <a href="http://www.w3.org/TR/CSS1/#floating-elements">W3.org: floating elements</a>.</p> |
91 | 114 | ref: <a href="http://css-tricks.com/all-about-floats/">css-tricks: float</a>, <a href="http://alistapart.com/article/css-floats-101">float 101</a> |
92 | 115 | </div> |
93 | | -<!-- <div id="data_attribute"> |
94 | | - <h2>2. data-*</h2> |
95 | | - <p><strong>Question:</strong> what is the use of data- attribute?</p> |
96 | | - <p><strong>Answer:</strong> allow you to store extra information/data in the DOM. u can write valid html withe embeded private data. You can easily access data attribute by using javascript and hence a lot of libraries like knockout uses it.</p> |
97 | | - <pre><code> |
98 | | -<div id="myDiv" data-user="jsDude" data-list-size="5" data-maxage="180"></div> |
99 | | - </code></pre> |
| 116 | +<div id="data_attribute"> |
| 117 | + <h2>2. clear</h2> |
| 118 | + <p><strong>Question:</strong> When will you use clear?</p> |
| 119 | + <p><strong>Answer:</strong> clear is used to stop wrap of an element around a floating element. .</p> |
| 120 | + |
100 | 121 | <p>ref: <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes">MDN: data-*</a>, <a href="http://www.sitepoint.com/use-html5-data-attributes/">use data attribute</a></p> |
101 | | - </div> --> |
| 122 | + </div> |
102 | 123 | <!-- <div id="keygen"> |
103 | 124 | <h2>3. keygen</h2> |
104 | 125 | <p><strong>Question:</strong> How can u generate public key in html?</p> |
|
0 commit comments