blob: ebcdf58bc2acb37ae836a12e4170c5c7da9da6e6 (
plain) (
blame)
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
|
<style>
img {
width: 100%;
height: auto;
}
figure {
width: 20%;
}
</style>
<!-- EXAMPLE 1 ---------------------------------------------------------------->
<figure style="float: left;">
<img src="grad.png">
<figcaption>Fig 1: wow such colors</figcaption>
</figure>
<p><i>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Nunc lobortis mattis aliquam
faucibus. A iaculis at erat pellentesque adipiscing. Dolor morbi non arcu risus
quis varius quam quisque. Fermentum odio eu feugiat pretium. Nibh nisl
condimentum id venenatis. Gravida dictum fusce ut placerat orci nulla. Pulvinar
etiam non quam lacus suspendisse faucibus interdum posuere. Pulvinar
pellentesque habitant morbi tristique senectus et netus et malesuada. Sem
fringilla ut morbi tincidunt augue interdum. Consectetur purus ut faucibus
pulvinar elementum. Dui faucibus in ornare quam. Sodales ut etiam sit amet
nisl. Nunc scelerisque viverra mauris in aliquam. Nec sagittis aliquam
malesuada bibendum arcu vitae elementum curabitur.
</i></p>
<figure style="float: right;">
<img src="grad.png">
<figcaption>Fig 2: wow such colors again</figcaption>
</figure>
<p><i>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Nunc lobortis mattis aliquam
faucibus. A iaculis at erat pellentesque adipiscing. Dolor morbi non arcu risus
quis varius quam quisque. Fermentum odio eu feugiat pretium. Nibh nisl
condimentum id venenatis.
</i></p>
<!-- EXAMPLE 2 ---------------------------------------------------------------->
<hr style="clear: both">
<figure style="float: left;">
<img src="grad.png">
</figure>
Floats can be next to each other on the same height.
<figure style="float: right;">
<img src="grad.png">
</figure>
<!-- EXAMPLE 3 ---------------------------------------------------------------->
<hr style="clear: both">
<figure style="float: left;">
<img src="grad.png">
</figure>
The css property <code>clear: {left, right, both};</code> controls how elements
should be handled relative to the previous floating element.
<figure style="float: right; clear: left;">
<img src="grad.png">
</figure>
<p><i>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Nunc lobortis mattis aliquam
faucibus. A iaculis at erat pellentesque adipiscing. Dolor morbi non arcu risus
quis varius quam quisque. Fermentum odio eu feugiat pretium. Nibh nisl
condimentum id venenatis. Gravida dictum fusce ut placerat orci nulla. Pulvinar
etiam non quam lacus suspendisse faucibus interdum posuere.
</i></p>
<!-- EXAMPLE 4 ---------------------------------------------------------------->
<hr style="clear: both">
<div style="overflow: auto; border: 2px solid red;">
<figure style="float: left;">
<img src="grad.png">
</figure>
<code>overflow: auto</code> gives an alternative to <code>clear</code> to
control placement of the floats. The red boarder visualizes the size of the
<code><div></code> block, you can remove the <code>overflow</code> property
and observe how the border changes.
</div>
<figure style="float: right;">
<img src="grad.png">
</figure>
|