Open8

ポートフォリオサイトをつくる

haruharu

height: 100vh; で画面いっぱいの高さを指定できる。

「vh(viewport height)」は、ビューポートの高さに対する割合です。
https://web.runland.co.jp/frontend/post-2766

haruharu

paddingはborderのなかの余白だけど、別にその要素に指定されたheight/widthの中に余白をとるわけではない!!そうしたいなら、box-sizing: border-box;を指定する


By default, the width and height of an element is calculated like this:
Width + Padding + Border = Actual width of an element
Height + Padding + Border = Actual height of an element

This means: The element's border and padding are added to the element's specified width/height.

Using the box-sizing property will allow you to include an elements padding and border as part of it's total height and width. When you set box-sizing: border-box; the element's padding and border will be included as a part of it's total width and height.

https://stackoverflow.com/questions/28688248/css-padding-vs-height#:~:text=height controls the actual height,the content and the border.

haruharu

いっしょ!
object.onclick = function(){myScript};
object.addEventListener("click", myScript);