HTML画面のavailWidthプロパティ
HTML Screen availWidthプロパティは、ユーザーの画面の使用可能な幅を返します。これは、ブラウザのインターフェイス機能を除外することを意味します。
構文
以下は構文です-
screen.availWidth
例
HTML画面のavailWidthプロパティの例を見てみましょう-
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
height: 100vh;
background-color: #FBAB7E;
background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%);
text-align: center;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 40%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
margin: 1rem auto;
}
.show {
font-size: 1.2rem;
margin: 1rem auto;
font-weight: bold;
font-family: sans-serif;
}
</style>
<body>
<h1>HTML screen availWidth Property</h1>
<button class="btn" onclick="get()">Show availWidth Value</button>
<div class="show"></div>
<script>
function get() {
document.querySelector(".show").innerHTML = "Available Width is " + screen.availWidth + " px";
}
</script>
</body>
</html> 出力
「availWidth値を表示」をクリックします 」ボタンをクリックして、availWidthプロパティの値を表示します-
-
HTML画面pixelDepthプロパティ
HTML Screen pixelDepthプロパティは、訪問者の画面の色解像度を返します。 構文 以下は構文です- screen.pixelDepth 例 HTML画面のpixelDepthプロパティの例を見てみましょう- <!DOCTYPE html> <html> <style> body { color: #000; height: 100vh; background-color: #FBAB7E
-
HTML画面のcolorDepthプロパティ
HTML画面のcolorDepthプロパティは、画像を表示するためのカラーパレットのビット深度を返します(ピクセルあたりのビット数)。 構文 以下は構文です- screen.colorDepth 例 HTML画面のcolorDepthプロパティの例を見てみましょう- <!DOCTYPE html> <html> <style> body { color: #000; height: 100vh; back