Cma Manual
Cma Manual
2. Write an html program to create and display navigation menus using list tags and
anchor tag
<html>
<head>
<title>Navigation Menu Example</title>
<style>
ul {
overflow: hidden;
background-color:black;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
</style>
SSIBM,TUMKUR Page 1
CMA MANUAL
</head>
<body>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</body>
</html>
SSIBM,TUMKUR Page 2
CMA MANUAL
SSIBM,TUMKUR Page 3
CMA MANUAL
4. Write an html code to create a frameset having header, navigation and content
sections.
P4.html
<html>
<head>
<title></title>
</head>
<frameset cols="20%,80%">
<frame src="p4link.html">
<frameset rows="20%,80%">
<frameset cols="30,30,40">
<frame src="p4home.html">
<frame src="p4about.html">
<frame src="p4reg.html">
</frameset>
<frame src="p4des.html">
</frameset>
</frameset>
</html>
P4link.html
<html>
<body>
<h2>link1</h2>
<h2>link2</h2>
<h2>link3</h2>
</body>
SSIBM,TUMKUR Page 4
CMA MANUAL
</html>
P4home.html
<html>
<head>
<title></title>
</head>
<body>
<h2>home</h2>
</body>
</html>
P4about.html
<html>
<head>
<title></title>
</head>
<body>
<h2>about</h2>
</body>
</html>
P4reg.html
<html>
<head>
<title></title>
</head>
<body>
<h2>registration</h2>
</body>
</html>
P4des.html
<html>
<head>
<title></title>
</head>
<body>
<h2>description on the page</h2>
</body>
</html>
SSIBM,TUMKUR Page 5
CMA MANUAL
5. Write an html program to create student registrations form on submitting the form
check whether fields are empty or not using javascript. If any fields are empty display
an error message.
<html>
<head>
<title>Student Registration Form</title>
<script>
function validateForm() {
var firstName = document.forms["registrationForm"]["firstName"].value;
var lastName = document.forms["registrationForm"]["lastName"].value;
var email = document.forms["registrationForm"]["email"].value;
var phoneNumber = document.forms["registrationForm"]["phoneNumber"].value;
if (firstName === "" || lastName === "" || email === "" || phoneNumber === "") {
alert("Please fill in all fields!");
return false;
}
}
</script>
</head>
<body>
<h1>Student Registration Form</h1>
<form name="registrationForm" onsubmit="return validateForm()">
<label for="firstName">First Name:</label>
<input type="text" id="firstName" name="firstName"><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
SSIBM,TUMKUR Page 6
CMA MANUAL
<html>
<head>
<style>
body {
font-family: Arial;
color:black;
background-color:grey;
margin: 0;
padding: 20px;
}
.cv {
background-color:white;
padding: 20px;
SSIBM,TUMKUR Page 7
CMA MANUAL
.personal-info {
margin-bottom: 20px;
}
.personal-info h1 {
font-size: 24px;
margin-bottom: 10px;
}
.personal-info p {
font-size: 16px;
}
.work-experience {
margin-bottom: 20px;
}
.work-experience h2 {
font-size: 20px;
margin-bottom: 10px;
}
.work-experience p {
font-size: 14px;
}
</style>
</head>
<body>
<div class="cv">
<div class="personal-info">
<h1>Anu</h1>
<p>Address:vidyanagar,Tumkur,karnataka-572105</p>
<p>Email: [email protected]</p>
<p>Phone: (123) 456-7890</p>
</div>
<div class="work-experience">
<h2>Work Experience</h2>
<p>Company A - Position A - 2010 to 2015</p>
<p>Company B - Position B - 2015 to 2020</p>
</div>
</div>
</body>
</html>
SSIBM,TUMKUR Page 8
CMA MANUAL
7. Write an HTML program to create div and apply the following CSS properties on
created div Margin
Padding
Border
Box shadow
<html>
<head>
<title>Div with CSS Properties</title>
<style>
/* CSS properties applied to the div */
#myDiv {
margin: 20px;
padding: 10px;
border: 1px solid #ccc;
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}
</style>
</head>
<body>
<div id="myDiv">
<!-- Content within the div -->
<h1>Div with CSS Properties</h1>
<p>This is a div element with custom CSS properties applied.</p>
</div>
</body>
</html>
SSIBM,TUMKUR Page 9
CMA MANUAL
8. Write an HTML program to create a box and using CSS transform and transition
properties move the box to the center of the web page on loading web-page
<html>
<head>
<style>
.box {
width: 200px;
height: 200px;
background-color: red;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
transition: transform 1s ease;
}
.box.move-to-center {
transform: translate(0, 0);
}
</style>
<script>
window.addEventListener('load', function() {
var box = document.getElementById('box');
box.classList.add('move-to-center');
});
</script>
</head>
<body>
<div class="box" id="box"></div>
</body>
SSIBM,TUMKUR Page 10
CMA MANUAL
</html>
9. Write an HTML program to create a circle and create an animation of bouncing of the
circle for 10 sec
<html>
<head>
<style>
.circle {
width: 100px;
height: 100px;
border-radius: 50%;
background-color: red;
position: relative;
animation-name: bounce;
animation-duration: 10s;
animation-iteration-count: infinite;
}
@keyframes bounce {
0% { top: 0; }
50% { top: 300px; }
100% { top: 0; }
}
</style>
</head>
<body>
<div class="circle"></div>
</body>
</html>
SSIBM,TUMKUR Page 11
CMA MANUAL
<html>
<head>
<style>
/* Loading animation */
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.loader {
border: 16px solid #f3f3f3; /* Light gray */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 120px;
height: 120px;
animation-name: spin;
animation-duration: 2s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
</style>
</head>
<body>
<div class="loader"></div>
</body>
</html>
SSIBM,TUMKUR Page 12
CMA MANUAL
Part-B
1. Write an HTML program to draw line, polyline and rectangle and fill rectangle with
red color using SVG tag.
<!DOCTYPE html>
<html>
<head>
<title>SVG Drawing</title>
</head>
<body>
<svg width="400" height="400">
<!-- Line -->
<line x1="50" y1="50" x2="200" y2="50" stroke="black" stroke-width="2" />
SSIBM,TUMKUR Page 13
CMA MANUAL
2. Write an HTML program to draw star and multiple circle and with different color
using SVG tag
<!DOCTYPE html>
<html>
<head>
<title>SVG Drawing</title>
</head>
<body>
<svg width="400" height="400">
<!-- Star -->
<polygon points="200,50 225,150 325,150 250,200 275,300 200,250 125,300
150,200 75,150 175,150" stroke="black" fill="gold" />
SSIBM,TUMKUR Page 14
CMA MANUAL
3. Write an HTML program to create logo with linear gradient properties using SVG tag.
<!DOCTYPE html>
<html>
<head>
<title>SVG Logo with Linear Gradient</title>
</head>
<body>
<svg width="400" height="400">
<!-- Define the linear gradient -->
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="pink" />
<stop offset="100%" stop-color="skyblue" />
</linearGradient>
<!-- Draw the logo using the linear gradient -->
<rect x="50" y="50" width="300" height="300" fill="url(#gradient)" />
</svg>
</body>
</html>
SSIBM,TUMKUR Page 15
CMA MANUAL
4. Write an HTML program to draw Square and Rectangle using canvas tag and
JavaScript.
<!DOCTYPE html>
<html>
<head>
<title>Canvas Drawing</title>
<style>
canvas {
border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="myCanvas" width="400" height="400"></canvas>
<script>
// Get the canvas element
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
// Draw a square
ctx.fillStyle = "red";
ctx.fillRect(50, 50, 100, 100);
// Draw a rectangle
ctx.fillStyle = "blue";
ctx.fillRect(200, 100, 150, 80);
</script>
SSIBM,TUMKUR Page 16
CMA MANUAL
</body>
</html>
5. Write an HTML program to draw bezier curve using canvas tag and JavaScript.
<!DOCTYPE html>
<html>
<head>
<title>Canvas Drawing</title>
<style>
canvas {
border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="myCanvas" width="400" height="400"></canvas>
<script>
// Get the canvas element
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
SSIBM,TUMKUR Page 17
CMA MANUAL
ctx.beginPath();
ctx.moveTo(startX, startY);
ctx.quadraticCurveTo(controlX, controlY, endX, endY);
ctx.strokeStyle = "red";
ctx.lineWidth = 2;
ctx.stroke();
</script>
</body>
</html>
6. Write an HTML program to draw a rectangle box using canvas and to change
background color to red, scale of the rectangle to 2 on move-over (hover) properties.
<!DOCTYPE html>
<html>
<head>
<title>Canvas Rectangle Box</title>
<style>
canvas {
border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="myCanvas" width="400" height="400"></canvas>
<script>
// Get the canvas element
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
SSIBM,TUMKUR Page 18
CMA MANUAL
if (isHovered) {
ctx.fillStyle = "red";
ctx.scale(2, 2);
} else {
ctx.fillStyle = "blue";
ctx.scale(1, 1);
}
canvas.addEventListener("mouseout", function() {
isHovered = false;
drawRectangle();
});
SSIBM,TUMKUR Page 19
CMA MANUAL
SSIBM,TUMKUR Page 20