Page 185 - CITS - CSA - TP (Volume 1) - Hindi
P. 185
कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS
<style>
/* CSS for demonstration purposes only */
.box {
width: 100px;
height: 100px;
background-color: blue;
color: white;
text-align: center;
line-height: 100px;
margin: 20px;
}
</style>
</head>
<body>
<div id=”box1” class=”box”>Box 1</div>
<div id=”box2” class=”box”>Box 2</div>
<script>
// Get references to the HTML elements
const box1 = document.getElementById(‘box1 );
const box2 = document.getElementById(‘box2 );
// Apply CSS styles programmatically
box1.style.backgroundColor = ‘red ;
box1.style.color = ‘black ;
box1.style.border = ‘2px solid black ;
box2.style.backgroundColor = ‘green ;
box2.style.color = ‘white ;
box2.style.border = ‘2px solid white ;
</script>
</body>
</html>
3 ो ाम को .html फ़ाइल के प म सेव कर
4 वेब ाउज़र से html फ़ाइल ओपन कर
5 आउटपुट की वेरीफाई कर ।
169
CITS : IT & ITES - कं ूटर सॉ वेयर ए ीके शन - अ ास 44

