<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OTCHY.NET &#187; float</title>
	<atom:link href="http://www.otchy.net/tag/float/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.otchy.net</link>
	<description>Otchy の技術ネタ。JavaScript 率と Twitter 率がやや高く、他にも PHP/Java/Perl などなど。共通点は Web。</description>
	<lastBuildDate>Wed, 01 Feb 2012 14:39:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>右下または左下においた画像に文字列を回り込ませるHTML/CSS</title>
		<link>http://www.otchy.net/20090219/bottom-image-floating/</link>
		<comments>http://www.otchy.net/20090219/bottom-image-floating/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 12:13:45 +0000</pubDate>
		<dc:creator>Otchy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://www.otchy.net/?p=298</guid>
		<description><![CDATA[
普通、HTML で画像の回り込みというと、右上か左上に画像があって、そこに文字列が回り込むという感じです。これは簡単です。画像に対して float: left; すれば OK です。
しかし、右下か左下に画像を固定して [...]]]></description>
			<content:encoded><![CDATA[<p>
普通、HTML で画像の回り込みというと、右上か左上に画像があって、そこに文字列が回り込むという感じです。これは簡単です。画像に対して float: left; すれば OK です。<br />
しかし、右下か左下に画像を固定して、文字列がそこにたどり着いたら回り込むという動作は一筋縄ではいきません。<br />
<a href="http://h2ham.seesaa.net/article/102886385.html" target="_blank">画像をブロックの左下に配置してテキストを回り込ませる方法を考える</a> というページで色々と考察されていて、ふむふむと思ったのですが、この方法では、テキストの量が変わるたびに調整が必要になってしまうので、テキストの量が動的に変わる場合には対応しにくいです。<br />
何より、文章をぶった切って画像を入れるというのはどうもスマートではありません。
</p>
<p>色々と試行錯誤してみたところ、以下の方法で実現できそうだったので、公開してみます。</p>
<pre class="height_narrow">&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
#block {
    width: 200px;
    height: 200px;
    overflow: hidden;
    font-size: 10pt;
    border: solid 1px #666;
    padding: 0.5em;
}
#bar {
    float: right;
    width: 1px;
    height: 100px;
    background-color: red;
}
#img {
    float: right;
    clear: both;
    width: 100px;
    height: 100px;
    background-color: blue;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="block"&gt;
&lt;div id="bar"&gt;&lt;/div&gt;
&lt;div id="img"&gt;&lt;/div&gt;
ああああああああああああああああああああああああああああ
ああああああああああああああああああああああああああああ
ああああああああああああああああああああああああああああ
ああああああああああああああああああああああああああああ
ああああああああああああああああああああああああああああ
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>
このソースを保存して開くと、以下のような見た目になります。<br />
わかりやすいように色分けした div で表現していますが、赤線は実際には透明、青い四角は実際には画像だと思って下さい。
</p>
<style>
#block {
    width: 200px;
    height: 200px;
    overflow: hidden;
    font-size: 10pt;
    border: solid 1px #666;
    padding: 0.5em;
}
#bar {
    float: right;
    width: 1px;
    height: 100px;
    background-color: red;
}
#img {
    float: right;
    clear: both;
    width: 100px;
    height: 100px;
    background-color: blue;
}
</style>
<div id="block">
<div id="bar"></div>
<div id="img"></div>
<p>ああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ
</p></div>
<p>
#bar の部分とか美しいマークアップとは言えないですし、画像に文字が被ったりとかしてますが、微調整してやれば十分使い物になるかと思います。<br />
最初は絶対実現できないんじゃないかと思ったので、出来た時は嬉しかったですね～。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otchy.net/20090219/bottom-image-floating/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

