Professional Documents
Culture Documents
Assignment-2
1. Define CSS and Explain CSS types with example.
CSS, or Cascading Style Sheets, is a stylesheet language used to describe the presentation and
formatting of HTML (Hypertext Markup Language) documents. It allows web developers to control
how web pages look and how they are displayed on various devices and screen sizes. CSS separates
the structure and content of a webpage (defined by HTML) from its visual appearance, making it
easier to maintain and update the design of a website.
1. Inline CSS:
Inline CSS is applied directly to individual HTML elements using the style attribute.
Example:
<p style="color: blue; font-size: 16px;">This is a blue-colored text with a 16px font
size.</p>
Internal CSS is defined within the HTML document itself, typically in the <style> tag
within the <head> section of the HTML document.
Example:
<!DOCTYPE html>
<html> <head>
</head> <body>
</body> </html>
3. External CSS:
External CSS is defined in a separate CSS file with a .css extension. This file is linked
to an HTML document using the <link> element in the <head> section.
It allows for the separation of style from content and can be reused across multiple
HTML pages.
<!DOCTYPE html>
1
Web Technology IU2141220103
<html> <head>
</head> <body>
</body> </html>
Internal CSS is applied to all <p> elements within the HTML document.
External CSS is defined in a separate file and linked to the HTML document, also affecting all
<p> elements.
Each type of CSS has its use case, but external CSS is the most common choice for larger projects
because it promotes maintainability and reusability by keeping the styling separate from the HTML
content.
1. Border Radius:
The border-radius property allows you to create rounded corners for elements, such
as divs and buttons.
Example:
2. Box Shadow:
Example:
3. Text Shadow:
Example:
2
Web Technology IU2141220103
4. Gradients:
CSS3 allows you to create gradient backgrounds using the linear-gradient and radial-
gradient functions.
5. Transform:
Example (rotate):
6. Transition:
The transition property lets you create smooth transitions between CSS property
changes, adding interactivity to your web pages.
Example:
7. @keyframes Animation:
CSS3 introduced the @keyframes rule, which allows you to create animations with
keyframe sequences.
Example:
These are just a few examples of the many CSS3 properties and features that enhance the design and
interactivity of web pages. CSS3 has greatly expanded the possibilities for web designers and
developers to create visually appealing and dynamic websites.
3
Web Technology IU2141220103
achieved using the transform property in CSS. Here, I'll explain some common transformations with
examples:
1. Translate (Move):
Translating an element means changing its position on the screen without altering its
size or shape.
Example:
<div class="translated-box">This box has been moved 50px to the right and 30px
down.</div>
2. Scale:
Example:
<div class="scaled-box">This box has been scaled up by 1.5 times its original
size.</div>
3. Rotate:
Example:
4. Skew:
5. Combining Transformations:
6. Transform Origin:
You can also specify a transformation origin, which determines the point around
which the transformation is applied.
4
Web Technology IU2141220103
Example:
Transformations are a powerful tool for creating interactive and visually appealing web content. They
can be combined with transitions and animations to create even more dynamic effects on your web
pages.
1. ID Selector (#):
Example:
In this example, the CSS rule #my-paragraph targets the <p> element with the ID
"my-paragraph" and changes its text color to blue.
A class selector targets one or more HTML elements that share the same class
attribute.
To select elements by their class, you use a . followed by the class name.
Example:
The CSS rule .highlight targets both <p> elements with the class "highlight" and gives
them a yellow background color.
It is represented by an asterisk *.
Example:
* { margin: 0; padding: 0; }
5
Web Technology IU2141220103
In this example, the universal selector is used to remove default margin and padding
from all HTML elements on the page.
These selectors help you apply styles to specific elements or groups of elements in your HTML
documents. ID selectors are typically used for unique elements, class selectors for multiple elements
with a shared class, and the universal selector for global styling or resetting default browser styles.
Suppose you want to create a simple animation that makes a div element move from left to right
continuously. Here's how you can do it:
1. HTML:
<div class="animated-div"></div>
2. CSS:
In this example:
We define a CSS animation named moveRight using the @keyframes rule. This animation
changes the left property of the element from 0 to 300px over a duration of 3 seconds (3s)
with a linear timing function.
The infinite value for animation-iteration-count makes the animation repeat indefinitely.
Now, when you load the HTML page, the div with the class animated-div will smoothly move from
left to right and then restart, creating a continuous animation.
CSS animations offer a wide range of possibilities beyond simple movements. You can animate
properties like opacity, transform, colors, and more to create various visual effects. Additionally, you
can control the animation's timing, direction, and duration to achieve the desired effect for your web
application.
6
Web Technology IU2141220103
The primary property for creating multi-column layouts in CSS is column-count, although there are
related properties like column-gap, column-rule, and column-width that can be used to further
customize the appearance of the columns. Here's an explanation of the key properties:
1. column-count:
The column-count property specifies the number of columns you want to divide
your content into.
Example:
.multi-column-text { column-count: 3; }
In this example, the text within elements with the class .multi-column-text will be
divided into three columns.
2. column-gap:
The column-gap property sets the space (in pixels or other units) between columns.
Example:
This will create a two-column layout with a 20-pixel gap between the columns.
3. column-rule:
The column-rule property allows you to add a line, or "rule," between columns,
specifying its width, style, and color.
Example:
4. column-width:
The column-width property sets a fixed width for the columns. You can use it instead
of column-count to create columns of a specific width.
Example:
This will create columns with a fixed width of 200 pixels, and the number of columns
will adjust based on the available space.
The multi-column layout is particularly useful for displaying long articles or text content in a more
readable and visually appealing way, especially on larger screens. However, it's important to consider
the responsiveness of your design and adapt the number of columns and column width for different
screen sizes using media queries if necessary.
7
Web Technology IU2141220103
software applications, websites, or other systems. A well-designed user interface is crucial for
providing a positive user experience and ensuring that users can efficiently and effectively
accomplish their tasks. Here's an explanation of user interfaces with an example:
1. Input Elements: These components allow users to input data or interact with the system.
Examples include text fields, buttons, checkboxes, radio buttons, dropdown menus, and
touch gestures on a mobile device.
2. Output Elements: These components display information to users. Examples include text,
images, videos, charts, and notifications.
3. Navigation Elements: These components enable users to move within the system or
between different sections of an application. Examples include menus, tabs, breadcrumbs,
and links.
4. Feedback Elements: These components provide feedback to users about their interactions
with the system, such as success messages, error messages, progress indicators, and tooltips.
5. Layout and Design: The arrangement and visual design of elements are critical for usability
and aesthetics. Layout includes the positioning of elements on the screen, and design
involves aspects like color, typography, and visual hierarchy.
6. Interactivity: User interfaces often include interactive elements that respond to user actions.
For instance, buttons change appearance when clicked, or elements can be dragged and
dropped.
Let's consider a simple example of a user interface for a weather application. In this case, the user
interface could consist of the following elements:
Input Elements: A text field where users can enter a location (e.g., a city name), a button to
initiate the search, and checkboxes to specify weather parameters (e.g., temperature,
humidity).
Output Elements: A section to display the weather information for the selected location,
including current temperature, forecast, and any weather alerts. This section may include
icons, charts, and textual descriptions.
Navigation Elements: A menu or tabs that allow users to switch between different locations
or weather-related features (e.g., current weather, 7-day forecast, radar view).
Feedback Elements: Messages that inform users about the success of their search, any
errors encountered (e.g., invalid location), and notifications for weather updates (e.g., "Rain
expected in 30 minutes").
Layout and Design: The design of the interface includes choosing an appropriate color
scheme (e.g., blue for a weather app), using readable fonts, and arranging elements in a
logical and aesthetically pleasing manner.
8
Web Technology IU2141220103
Interactivity: Users can click the search button to initiate a search, toggle checkboxes to
customize the weather information, and perhaps drag a map to explore different locations.
A well-designed weather app user interface will make it easy for users to input their preferences,
understand the weather information presented, and navigate between features, ultimately providing
a positive user experience. Good design considerations, responsiveness to user actions, and clear
feedback are key factors in the success of a user interface.
Bootstrap provides a responsive, 12-column grid system that allows you to create
flexible and responsive layouts for your web pages. You can use classes like
.container, .row, and .col-* (where * represents the column width) to structure your
content within a grid.
Example:
In this example, two columns are created within a container, and the layout will
automatically adjust based on the screen size.
2. Responsive Typography:
Bootstrap offers styles for typography to ensure consistent and readable text across
different devices. You can use classes like .h1, .h2, .lead, and .text-* to style headings
and text.
Example:
3. Pre-designed Components:
Example:
4. Responsive Utilities:
9
Web Technology IU2141220103
Bootstrap provides utility classes for hiding, showing, and adjusting the visibility of
elements based on screen size. Classes like .d-none, .d-md-block, and .mx-auto help
create responsive designs.
Example:
5. Customization:
10