首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在窗口内放大/缩小会导致图像重复

在窗口内放大/缩小会导致图像重复
EN

Stack Overflow用户
提问于 2018-05-30 10:19:49
回答 1查看 237关注 0票数 1

我大约在3天前开始做web开发。我试着在3个月内学到尽可能多的东西,没有框架或拖放工具。我的第一个网站是试图翻拍csszengarden.com,是的,它看起来更糟糕,但我学到了很多。这是它在100%变焦时的样子。http://prntscr.com/jocan3这是它在25%变焦时的样子。http://prntscr.com/jocb3z图像复制,而图像角中的文本不复制。我如何解决这两个问题呢?我的代码有点乱(我认为),所以一些关于这方面的技巧也会很受欢迎。

代码语言:javascript
复制
body {
  margin: 0;
  font-family: Verdana, sans-serif;
  font-size: 100%;
}

h1 {
  margin: 0;
}

p {
  word-wrap: break-word;
  width: 55%;
  line-height: 1.8em;
  margin: 0;
}

#endofheader2 {
  margin-bottom: 4%;
}

.participation {
  position: absolute;
  margin-top: 64%;
  color: black;
  position: absolute;
  margin-left: 10%;
}

.headbar {
  opacity: 0.7;
  color: white;
  font-family: Bahnschrift, Verdana, sans-serif;
  position: absolute;
  width: 100%;
  height: 32%;
  background-color: black;
  background-image: url(../img/garden8.jpg);
  object-position: 50% 150%;
  object-fit: none;
  border-bottom: 1px solid rgba(173, 216, 230, 0.7);
}

.header-3 {
  font-size: 28px;
  margin-bottom: 0.7%;
}

.header-1 {
  font-size: 28px;
  margin-bottom: 0.7%;
}

#endofheader-1 {
  margin-bottom: 2%;
}

.about {
  margin-top: 40%;
  color: black;
  position: absolute;
  margin-left: 10%;
}

.header-2 {
  font-size: 28px;
  margin-bottom: 0.7%;
}

.theroad {
  margin-top: 25%;
  color: black;
  position: absolute;
  margin-left: 10%;
}

.benefits {
  margin-top: 84%;
  color: black;
  position: absolute;
  margin-left: 10%;
}

.header-4 {
  font-size: 28px;
  margin-bottom: 0.7%;
}

#csszengarden {
  font-size: 150%;
  margin-left: 20%;
  margin-top: 4%;
  margin-bottom: 0;
}

#headbar h1 {
  font-size: 3.2em;
  text-transform: uppercase;
}

#beautyofcss {
  margin-top: 0;
  font-family: "Segoe Script", Verdana, sans-serif;
  margin-left: 20%;
}

#nonlineargradient {
  position: absolute;
  width: 35%;
  height: 600%;
  background-color: rgba(65, 104, 37, 0.1);
  margin-left: 66%;
}

.nonlineargradient-2 {
  position: absolute;
  width: 100%;
  height: 70%;
  background-color: rgba(110, 196, 176, 0.4);
  margin-top: 60%;
}

.requirements {
  margin-top: 98%;
  color: black;
  position: absolute;
  margin-left: 10%;
}

.header-5 {
  font-size: 28px;
  margin-bottom: 0.7%;
}
代码语言:javascript
复制
<!DOCTYPE html>
<html>

<head>
  <link rel="stylesheet" href="css/style.css">
</head>

<body>
  <div class="headbar">
    <h1 id="csszengarden">CSS ZEN GARDEN</h1>
    <h2 id="beautyofcss">The Beauty of CSS Design</h2>
  </div>
  <div id="nonlineargradient"></div>
  <div class="theroad">
    <p class="header-1">THE ROAD TO ENLIGHTENMENT</p>
    <p>Littering a dark and dreary road lay the past relics of browser-specific tags, incompatible DOMs, broken CSS support, and abandoned browsers.</p>
    <br>
    <p>We must clear the mind of the past. Web enlightenment has been achieved thanks to the tireless efforts of folk like the W3C, WASP, and the major browser creators.</p>
    <br>
    <p id="endofheader-1">The CSS Zen Garden invites you to relax and meditate on the important lessons of the masters. Begin to see with clarity. Learn to use the time-honored techniques in new and invigorating fashion. Become one with the web.</p>
  </div>
  <div class="about">
    <p class="header-2">SO WHAT IS THIS ABOUT?</p>
    <p>There is a continuing need to show the power of CSS. The Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing designs in the list. Clicking on any one will load the style sheet into this very page. The
      HTML remains the same, the only thing that has changed is the external CSS file. Yes, really.</p>
    <br>
    <p id="endofheader-2">CSS allows complete and total control over the style of a hypertext document. The only way this can be illustrated in a way that gets people excited is by demonstrating what it can truly be, once the reins are placed in the hands of those able to
      create beauty from structure. Designers and coders alike have contributed to the beauty of the web; we can always push it further.</p>
  </div>
  <div class="participation">
    <p class="header-3">PARTICIPATION</p>
    <p>Strong visual design has always been our focus. You are modifying this page, so strong CSS skills are necessary too, but the example files are commented well enough that even CSS novices can use them as starting points. Please see the CSS Resource
      Guide for advanced tutorials and tips on working with CSS.</p>
    <br>
    <p>You may modify the style sheet in any way you wish, but not the HTML. This may seem daunting at first if you’ve never worked this way before, but follow the listed links to learn more, and use the sample files as a guide.</p>
    <br>
    <p>Download the sample HTML and CSS to work on a copy locally. Once you have completed your masterpiece (and please, don’t submit half-finished work) upload your CSS file to a web server under your control. Send us a link to an archive of that file and
      all associated assets, and if we choose to use it we will download it and place it on our server.</p>
  </div>
  <div class="benefits">
    <p class="header-4">BENEFITS</p>
    <p>Why participate? For recognition, inspiration, and a resource we can all refer to showing people how amazing CSS really can be. This site serves as equal parts inspiration for those working on the web today, learning tool for those who will be tomorrow,
      and gallery of future techniques we can all look forward to.</p>
  </div>
  <div class="nonlineargradient-2"></div>
  <div class="requirements">
    <p class="header-5">REQUIREMENTS</p>
    <p>Where possible, we would like to see mostly CSS 1 & 2 usage. CSS 3 & 4 should be limited to widely-supported elements only, or strong fallbacks should be provided. The CSS Zen Garden is about functional, practical CSS and not the latest bleeding-edge
      tricks viewable by 2% of the browsing public. The only real requirement we have is that your CSS validates.</p>
    <br>
    <p>Luckily, designing this way shows how well various browsers have implemented CSS by now. When sticking to the guidelines you should see fairly consistent results across most modern browsers. Due to the sheer number of user agents on the web these
      days — especially when you factor in mobile — pixel-perfect layouts may not be possible across every platform. That’s okay, but do test in as many as you can. Your design should work in at least IE9+ and the latest Chrome, Firefox, iOS and Android
      browsers (run by over 90% of the population).</p>
    <br>
    <p>We ask that you submit original artwork. Please respect copyright laws. Please keep objectionable material to a minimum, and try to incorporate unique and interesting visual themes to your work. We’re well past the point of needing another garden-related
      design.
    </p>
    <br>
    <p>This is a learning exercise as well as a demonstration. You retain full copyright on your graphics (with limited exceptions, see submission guidelines), but we ask you release your CSS under a Creative Commons license identical to the one on this
      site so that others may learn from your work.</p>
  </div>

</html>

EN

回答 1

Stack Overflow用户

发布于 2018-05-30 10:26:37

使用标题栏上的background-repeat属性并将其设置为no-repeat

代码语言:javascript
复制
.headbar {
  background-repeat: no-repeat;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50595480

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档