February 22, 2024

Introduction to CSS

Introduction to CSS

CSS, short for Cascading Style Sheets, is a programming language used for styling and formatting web documents written in HTML or XML. It defines how the content of a web page should be displayed, including the layout, colors, fonts, and other visual aspects. CSS allows web designers to separate the presentation layer from the structure and content of a webpage, resulting in cleaner and more maintainable code.

CSS works by associating style rules with HTML elements. These style rules consist of a property and a value pair, which specify the visual properties to be applied to the selected elements. For example, you can define the color, font size, and margin of a paragraph using CSS.

CSS can be applied in three ways:

  1. Inline CSS: Inline styles are directly applied to individual HTML elements using the “style” attribute. For example:
   <h1 style="color: blue;">Hello, World!</h1>
  1. Internal CSS: Internal styles are defined within the <style> tags in the <head> section of an HTML document. Multiple style rules can be specified within the <style> block. For example:
   <head>
     <style>
       h1 {
         color: blue;
       }
     </style>
   </head>
   <body>
     <h1>Hello, World!</h1>
   </body>
  1. External CSS: External styles are stored in separate CSS files and linked to HTML documents using the <link> tag. This allows styles to be shared across multiple web pages. For example:
   <head>
     <link rel="stylesheet" type="text/css" href="styles.css">
   </head>
   <body>
     <h1>Hello, World!</h1>
   </body>

In the “styles.css” file:

   h1 {
     color: blue;
   }

CSS provides a wide range of selectors to target specific HTML elements or groups of elements. Selectors can be based on element names, class names, IDs, attributes, and more. This allows precise control over which elements receive specific styling.

In addition to basic styling properties, CSS also supports advanced features like positioning elements, creating animations, adding transitions, and implementing responsive design techniques to adapt web content to different screen sizes.

CSS is an essential part of modern web development, allowing designers and developers to create visually appealing and consistent web pages across different browsers and devices.

Suggested readings:

First Year B Pharm Notes, Syllabus, Books, PDF Subjectwise/Topicwise

F Y B Pharm Sem-IF Y B Pharm Sem-II
BP101T Human Anatomy and Physiology I TheoryBP201T Human Anatomy and Physiology II – Theory
BP102T Pharmaceutical Analysis I TheoryBP202T Pharmaceutical Organic Chemistry I Theory
BP103T Pharmaceutics I TheoryBP203T Biochemistry – Theory
BP104T Pharmaceutical Inorganic Chemistry TheoryBP204T Pathophysiology – Theory
BP105T Communication skills TheoryBP205T Computer Applications in Pharmacy Theory
BP106RBT Remedial BiologyBP206T Environmental sciences – Theory
BP106RMT Remedial Mathematics TheoryBP207P Human Anatomy and Physiology II Practical
BP107P Human Anatomy and Physiology PracticalBP208P Pharmaceutical Organic Chemistry I Practical
BP108P Pharmaceutical Analysis I PracticalBP209P Biochemistry Practical
BP109P Pharmaceutics I PracticalBP210P Computer Applications in Pharmacy Practical
BP110P Pharmaceutical Inorganic Chemistry Practical
BP111P Communication skills Practical
BP112RBP Remedial Biology Practical