Web File
Web File
Ans.
A URL, or Uniform Resource Locator, is a reference or an address used to locate
resources on the internet. It serves as a standardized way to specify the location
of a resource, such as a webpage, a file, an image, or any other type of resource
accessible via the internet.
Output:
Q.6 What do you mean by z-index properties? Show three layers having
different colors in your document.
Ans.
The z-index property in CSS controls the stacking order of overlapping elements
on a webpage. It essentially determines which element appears on top and which
ones are hidden behind it, creating a layered effect.
Here is the example:
HTML CODE
CSS CODE
OUTPUT:
Q.7 Write a program using Java script to print zero to ten in different lines.
Ans.
JavaScript Code
OUTPUT:
Q.8 Explain about Flex Box with example ?
Flexbox, formally known as the CSS Flexible Box Layout Module, is a powerful
layout model in CSS that allows you to design flexible and responsive layouts
with ease. It provides a more efficient way to distribute space among items in a
container, even when their size is unknown or dynamic. Flexbox is particularly
useful for creating dynamic and complex layouts, such as navigation bars, grids,
card layouts, and more.
1. **Flex Container**: To use Flexbox, you need a flex container. Any HTML
element can be turned into a flex container by setting its display property to
`flex` or `inline-flex`. This container holds the flex items.
Ex.
.container {
display: flex; /* or inline-flex */
}
2. **Flex Items**: The child elements of a flex container are called flex items.
These items can be laid out in any direction within the flex container
(horizontally or vertically) and can also be re-ordered, aligned, and spaced using
Flexbox properties.
3. **Main Axis and Cross Axis**: Flexbox works along two axes: the main axis
and the cross axis. The main axis is the primary axis along which flex items are
laid out, determined by the `flex-direction` property. The cross axis is
perpendicular to the main axis.
4. **Flex Direction**: This property determines the main axis along which flex
items are laid out inside the flex container. It can be set to `row` (default), `row-
reverse`, `column`, or `column-reverse`.
Ex.
.container {
flex-direction: row; /* or row-reverse, column, or column-reverse */
}
5. **Justify Content**: This property aligns flex items along the main axis of the
flex container. It defines how extra space is distributed between and around flex
items. Common values include `flex-start`, `flex-end`, `center`, `space-between`,
and `space-around`.
Ex.
.container {
justify-content: center; /* or flex-start, flex-end, space-between, space-
around */
}
6. **Align Items**: This property aligns flex items along the cross axis of the
flex container. It specifies how flex items are aligned within the flex container
when they do not take up all the available space on the cross axis. Common
values include `flex-start`, `flex-end`, `center`, `baseline`, and `stretch`.
Ex.
.container {
align-items: center; /* or flex-start, flex-end, baseline, stretch */
}
7. **Flex**: This property defines how a flex item grows or shrinks to fit the
available space in the flex container. It is a shorthand property for `flex-grow`,
`flex-shrink`, and `flex-basis
Ex.
.item {
flex: 1; /* flex-grow: 1; flex-shrink: 1; flex-basis: 0%; */
}
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flex box</title>
<link rel="stylesheet" href="flex.css">
</head>
<body>
<div class="center">
<div class="box box1"> box1</div>
<div class="box box2">box2</div>
<div class="box box3">box3</div>
<div class="box box4">box4</div>
</div>
</body>
</html>
CSS
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.center{
position: absolute;
top: 200px;
left: 10%;
height: 400px;
width: 80%;
border: 2px solid black;
border-radius: 4px;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.box{
height: 150px;
width: 150px;
border: 2px solid black;
}
.box1{
background-color: blueviolet;
}
.box2{
background-color: rgb(122, 213, 17);
}
.box3{
background-color: rgb(218, 147, 25);
}
.box4{
background-color: rgb(49, 18, 227);
}
OUTPUT
Q.9 Design a homepage of S.N. college of science using HTML and CSS.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta tags, title, and stylesheets -->
</head>
<body>
<header>
<!-- Header section -->
</header>
<div class="main">
<!-- Main navigation links -->
</div>
<div class="hero">
<!-- Hero section -->
</div>
</div>
<div class="container">
<section id="pic">
<!-- Slider section -->
</section>
<section class="nw">
<!-- University links and courses section -->
</section>
</div>
<!-- Gallery section starts -->
<div class="main-section gallery">
<!-- Gallery content -->
</div>
<!-- Gallery section ends -->
</body>
<!-- JavaScript -->
<script src="swiper-bundle.min.js"></script>
<script src="script.js"></script>
</html>
CSS
/* Resetting default margin, padding, and box-sizing */
* {
margin: 0%;
padding: 0%;
box-sizing: border-box;
}
/* Styling header */
header {
/* Header background color and dimensions */
}
/* Styling logo */
.logo {
/* Logo styling */
}
/* Styling search */
.search {
/* Search styling */
}
/* Styling buttons */
button {
/* Button styling */
}
/* Styling input */
input {
/* Input styling */
}
/* Styling card */
.card {
/* Card styling */
}
/* Styling blocks */
.block {
/* Blocks styling */
}
/* Styling marquee */
marquee {
/* Marquee styling */
}
/* Gallery styling */
.gallery img {
/* Gallery image styling */
}
/* Footer styling */
.footer {
/* Footer styling */
}
/* Container width */
.container {
/* Container width */
}
Output