【发布时间】:2016-10-24 01:05:27
【问题描述】:
我制作了一个红色的 svg 形状,看起来像这样:
我需要在如下所示的设计中使用这些形状:
我已将此 svg 文件嵌入到 img 标记中,并尝试使用绝对/相对定位对其进行定位,结果如下:
它看起来很完美,但是当我调整浏览器大小时,会发生这种情况:
我是 HTML/CSS 新手,显然不知道自己在做什么。也许这是处理它的错误方法......
这是我的 HTML:
<section id="whatwedo">
<div class="hat"><img src="img/hat.svg" alt="Startup" style="img-responsive;"></div>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1 class="text-center">what we do</h1>
<p class="text-center">We offer a wide range of software development and design options from a simple web development to more complicated information systems. We ensure our customers get the right thing, done the right way.</p>
</div>
<!--end col-md-8 col-md-offset-2-->
</div>
<!--end row-->
<div class="row fields">
<div class="col-sm-4 development-field">
<img src="img/development.svg" alt="Development" style="width:90px;height:90px;" class="img-responsive center-block">
<h2 class="text-center">develop</h2>
<p class="small text-center">We take pride in our experience in developing Java and PHP applications with different technologies and frameworks.</p>
<button type="button" class="btn btn-link center-block blue" role="link" type="submit" name="op" value="Link 2">more</button>
</div>
<div class="col-sm-4 design-field">
<img src="img/design.png" alt="Design" style="width:90px;height:90px;" class="img-responsive center-block">
<h2 class="text-center">design</h2>
<p class="small text-center">Beauty. Simplicity. Delight. We create beautiful user experiences to solve our customers’ business problems.</p>
<button type="button" class="btn btn-link center-block blue" role="link" type="submit" name="op" value="Link 2">more</button>
</div>
<div class="col-sm-4 startup-field">
<img src="img/startup.svg" alt="Startup" style="width:90px;height:90px;" class="img-responsive center-block">
<h2 class="text-center">startup</h2>
<p class="small text-center">We love being a part of new innovation and help your startup succeed by developing the technology you need to push forward.</p>
<button type="button" class="btn btn-link center-block blue" role="link" type="submit" name="op" value="Link 2">more</button>
</div>
</div>
<!--end row fields-->
</div>
<!--end container-->
</section>
<!--end whatwedo-->
这是 CSS:
/*what we do*/
.fields {
margin-top: 64px;
}
.development-field img,
.design-field img,
.startup-field img {
margin-bottom: 32px;
}
#aboutprocess {
margin-top: 64px;
padding: 64px 0;
background: url(../img/tech_bg.jpg) repeat center center fixed;
width: 100%;
height: 344px;
background-size: contain;
}
#aboutprocess p {
color: #ffffff;
padding-top: 60px;
}
.hat {
width: 100%;
position: absolute;
left: 0;
top: -110px;
}
#whatwedo {
position: relative;
}
我希望你们能帮助我。我已经为此工作了 3 个小时,我觉得我很快就会发疯。这是演示页面的link。谢谢。
【问题讨论】:
-
第一眼:也许你误会了 style="img-responsive;" , style 不能是一个类,试试 class="img-responsive" in
-
是的,你是对的,我更正了。谢谢你指出这一点。 :) @Bandi
标签: html css twitter-bootstrap svg