LoginSignup
3
5

More than 5 years have passed since last update.

CSSで画像に文字を重ねる

Posted at

<style>
    .mojikasane{
        position:relative;
    }
    .mojikasane span{
        position:absolute;
        bottom:5px;
        left:0px;
        width:150px;
        text-align:center;
        color:#fff;
        line-height:150%;
        background-color:#000;
        filter:alpha(opacity=60);
        -moz-opacity: 0.6;
        opacity: 0.6;
    }
    .mojikasane img{
        width:150px;
    }
</style>

<div class="mojikasane">
    <img src="[yourimg]" />
    <span>テキスト</span>
</div>


コピペで動くよ

3
5
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5