Skip to content

Commit 1c32443

Browse files
committed
upgraded float and clear
1 parent e0b072c commit 1c32443

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

css.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
height: 280px;
7171
border: 2px solid gray;
7272
padding: 5px;
73+
overflow-y: scroll;
74+
overflow-x: hidden;
7375
}
7476
.overflowBox{
7577
padding: 5px;
@@ -215,7 +217,7 @@ <h2>css related interview questions</h2>
215217
<div id="doctype">
216218
<h2>1. float</h2>
217219
<p><strong>Question:</strong> How float works?</p>
218-
<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>
220+
<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 smaller 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>
219221
<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>
220222
<div>
221223
<button id = "float" type="button" class="toggleExample btn btn-primary">show example</button>
@@ -239,8 +241,8 @@ <h2>1. float</h2>
239241
</div>
240242
<div id="data_attribute">
241243
<h2>2. clear</h2>
242-
<p><strong>Question:</strong> When will you use clear?</p>
243-
<p><strong>Answer:</strong> floating elements will not be accepted on the side you cleared. With 'clear' set to 'left', an element will be moved below any floating element on the left side. clear is used to stop wrap of an element around a floating element. .</p>
244+
<p><strong>Question:</strong> How can you clear side of a floating element?</p>
245+
<p><strong>Answer:</strong> If you clear a silde of an element, floating elements will not be accepted on that side. With 'clear' set to 'left', an element will be moved below any floating element on the left side. clear is used to stop wrap of an element around a floating element.</p>
244246
<div>
245247
<button id = "clear" type="button" class="toggleExample btn btn-primary">show example</button>
246248
<div id="clearExample" class="hide">
@@ -257,7 +259,9 @@ <h2>2. clear</h2>
257259
<div class="box"><span>5</span></div>
258260
</div>
259261
</div>
260-
</div>
262+
</div>
263+
<p><strong>Question:</strong> How can you fix, "floated points don't add up to the height of a parent"?</p>
264+
<p><strong>Answer:</strong> You can use <code>clear:both</code> in an empty div <code>&lt;div style="clear: both;"&gt;&lt;/div&gt;</code>, you can use overflow hidden or scroll and you can float the parent as well.</p>
261265
<p>ref: <a href="http://www.w3.org/TR/CSS1/#clear">W3.org: clear</a>
262266
</div>
263267
<div id="keygen">

0 commit comments

Comments
 (0)