--- id: 587d7791367417b2b2512ab5 title: 使用 height 屬性調整元素的寬度 challengeType: 0 videoUrl: 'https://scrimba.com/c/cEDaDTN' forumTopicId: 301034 dashedName: adjust-the-height-of-an-element-using-the-height-property --- # --description-- 和 `width` 屬性類似,你可以使用 CSS 裏面的 `height` 屬性來指定元素的高度。 下面這段代碼可以把圖片的高度設置爲 20px: ```css img { height: 20px; } ``` # --instructions-- 給 `h4` 標籤添加 `height` 屬性並將屬性值設置爲 25px。 **注意:**可能需要將瀏覽器的縮放比調整爲 100% 才能通過這一挑戰。 # --hints-- `h4` 的 `height` 屬性值應爲 25px。 ```js assert( Math.round(document.querySelector('h4').getBoundingClientRect().height) === 25 && /h4{\S*height:25px(;\S*}|})/.test($('style').text().replace(/\s/g, '')) ); ``` # --seed-- ## --seed-contents-- ```html
Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.
Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.