<?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>CSS  |  ITのあれこれ</title>
	<atom:link href="https://himatoto.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>https://himatoto.com</link>
	<description>初心者視点で分かりやすく</description>
	<lastBuildDate>Thu, 04 Feb 2021 17:21:33 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.3</generator>

<image>
	<url>https://himatoto.com/wp-content/uploads/2020/06/cropped-4495bed8051fcc9fd4ac4bababda36e3-32x32.png</url>
	<title>CSS  |  ITのあれこれ</title>
	<link>https://himatoto.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>【CSS】画像の上に文字を重ねて表示する方法</title>
		<link>https://himatoto.com/css1/</link>
					<comments>https://himatoto.com/css1/#respond</comments>
		
		<dc:creator><![CDATA[himatoto]]></dc:creator>
		<pubDate>Thu, 04 Feb 2021 17:20:10 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<guid isPermaLink="false">https://himatoto.com/?p=569</guid>

					<description><![CDATA[画像に文字を重ねて表示したい時に使用できるCSSの書き方。 目次 画像の上に文字を重ねて表示画像に重ねた文字を中央に表示 画像の上に文字を重ねて表示 HTML CSS 結果 画像に重ねた文字を中央に表示 HTML CSS [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>画像に文字を重ねて表示したい時に使用できるCSSの書き方。</p>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-2" checked><label class="toc-title" for="toc-checkbox-2">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">画像の上に文字を重ねて表示</a></li><li><a href="#toc2" tabindex="0">画像に重ねた文字を中央に表示</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">画像の上に文字を重ねて表示</span></h2>



<p>HTML</p>



<pre class="wp-block-code"><code>&lt;div class="parent"&gt;
    &lt;img src="./images/sample.png" /&gt;
    &lt;p&gt;サンプル&lt;/p&gt;
&lt;/div&gt;</code></pre>



<p>CSS</p>



<pre class="wp-block-code"><code>.parent {
    position: relative;
}

.parent p {
    position: absolute;
    color: #ffffff;
    top: 0;
    left: 0;
}</code></pre>



<p>結果</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="385" height="387" src="https://himatoto.com/wp-content/uploads/2021/02/blog_img.png" alt="" class="wp-image-570" srcset="https://himatoto.com/wp-content/uploads/2021/02/blog_img.png 385w, https://himatoto.com/wp-content/uploads/2021/02/blog_img-298x300.png 298w, https://himatoto.com/wp-content/uploads/2021/02/blog_img-150x150.png 150w, https://himatoto.com/wp-content/uploads/2021/02/blog_img-100x100.png 100w" sizes="(max-width: 385px) 100vw, 385px" /></figure>



<h2 class="wp-block-heading"><span id="toc2">画像に重ねた文字を中央に表示</span></h2>



<p>HTML</p>



<pre class="wp-block-code"><code>&lt;div class="parent"&gt;
    &lt;img src="./images/sample.png" /&gt;
    &lt;p&gt;サンプル&lt;/p&gt;
&lt;/div&gt;</code></pre>



<p>CSS</p>



<pre class="wp-block-code"><code>.parent {
    position: relative;
    width: 300px;
}

.parent img {
    width: 100%;
}

.parent p {
    position: absolute;
    color: #ffffff;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    margin: 0;
    padding: 0;
}</code></pre>



<p>結果</p>



<figure class="wp-block-image size-large"><img decoding="async" width="312" height="317" src="https://himatoto.com/wp-content/uploads/2021/02/blog_img2.png" alt="" class="wp-image-572" srcset="https://himatoto.com/wp-content/uploads/2021/02/blog_img2.png 312w, https://himatoto.com/wp-content/uploads/2021/02/blog_img2-295x300.png 295w" sizes="(max-width: 312px) 100vw, 312px" /></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://himatoto.com/css1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
