我正在try 制作一张图片,图片的左中间有一个标题.标题应始终位于图像的左中或左侧的任何位置,其大小应随浏览器大小而变化.
.page-overview{
width: 100%;
border: 1px solid black;
}
.overview-content img{
width: 100%;
}
.caption{
position: absolute;
top: 20%;
left: 18px;
font-size: 80%;
font-family: 'Source Sans Pro', sans-serif;
z-index: 1;
}
.caption span{
display: block;
margin: 8px 0;
padding: 10px 17px;
border-radius: 3px;
background-color: #00000033;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>test YOU</title>
</head>
<body>
<!--Here can have other content too-->
<div class="page-overview">
<div class="overview-content"><a href="#"><img src="https://images5.alphacoders.com/481/481903.png" alt="Delilious & Yum" height="auto"></a>
<div class="caption">
<span>Test your best here</span>
<span>It's Yum ?</span>
</div>
</div>
</div>