freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-princ.../use-a-retina-image-for-high...

1.7 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d78b1367417b2b2512b0a Use a Retina Image for Higher Resolution Displays 0 使用Retina图像获得更高分辨率的显示

Description

使图像显示为“视网膜”(并为视网膜显示进行优化)的最简单方法是将其widthheight值定义为原始文件的一半。以下是仅使用原始高度和宽度的一半的图像示例:
<风格>
img {身高250px;宽度250px; }
</样式>
<img src =“coolPic500x500”alt =“最精彩的图片”>

Instructions

img标记的widthheight设置为原始值的一半。在这种情况下,原始height和原始width都是200px。

Tests

tests:
  - text: 你的<code>img</code>标签应该有100像素的<code>width</code> 。
    testString: 'assert($("img").css("width") == "100px", "Your <code>img</code> tag should have a <code>width</code> of 100 pixels.");'
  - text: 你的<code>img</code>标签应该有100像素的<code>height</code> 。
    testString: 'assert($("img").css("height") == "100px", "Your <code>img</code> tag should have a <code>height</code> of 100 pixels.");'

Challenge Seed

<style>

</style>

<img src="https://s3.amazonaws.com/freecodecamp/FCCStickers-CamperBot200x200.jpg" alt="freeCodeCamp sticker that says 'Because CamperBot Cares'">

Solution

// solution required