【发布时间】:2017-01-30 10:43:47
【问题描述】:
我正在尝试重新创建类似于下面这张图片的东西,减去右上角的小卷页。
横幅示例:
我正在将代码添加到另一个设计师以前编码的网站。我首先单独对其进行编码,但无法使文本和横幅响应,尽管图像是。我也不能让它像我希望的那样覆盖在图像本身上。
下面是我的代码,我知道这很简单,但似乎遇到了心理障碍。
@charset "UTF-8";
/* CSS Document */
/*Header Image*/
.headerimage
img
{
}
h1
{
position: absolute;
display: block;
width: 100%;
font-size: 1.45em;
font-family: 'Roboto Slab', Rockwell, Serif;
font-weight: bold;
color: #FFF;
text-shadow: 0 .125em .125em rgba(0, 0, 0, .5);
padding: .6em 1em .6em 1.7em;
background: linear-gradient(to right, rgba(178,34,34,0) 0%,rgba(169,32,32,0.8) 5%,rgba(160,30,30,1) 50%,rgba(152,29,29,0.8) 75%,rgba(178,34,34,0) 100%);
}
.interior-header img
{
display: block;
position: relative;
width: 100%;
height: auto;
border: 1px solid #b22222;
padding: 1px;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test Heading</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<div class="interior-header img>
<div class="headerimage">
<img src="images/Joslyn-Interior-Images.jpg" width="630" height="240" alt="Traffic Control" />
<h1>Traffic Control</h1>
</div>
</div>
</body>
</html>
【问题讨论】:
-
这是一个改进。但是,我认为作为 JSFiddle 会更好。 (很难在代码 sn-p 中测试某些东西的响应能力。)此外,根据给出的信息,我无法判断您想要什么以及出了什么问题。只是我的两分钱。 :)
标签: html css image responsive