$100 Website Offer

Get your personal website + domain for just $100.

Limited Time Offer!

Claim Your Website Now

CSS (CASCADING STYLE SHEETS)

What is CSS?

CSS is a language used to style a web page. It describes how HTML pages should displayed on media or websites.

What are the uses of CSS?

CSS is used to define the styles for your web pages , including deisgns, layout variations, colors, variations etc.

CSS sytnax:

  • A css syntax csonsists of two blocks declaration block and selector block.
  • selector block points to the html you want to design or style
  • The declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon.

p {
  color: red;
  text-align: center;
}

In this code p is selector part which indicates the html element to style. and color and text-align are property. red and cente are property value.

CSS Selectors: These are used to find the HTML elements to style.

Simple selectors: Selects based on id, class

  • id selector: The id selector uses the id attribute of an HTML element to select a specific element. To select an element with a specific id, write a hash (#) character, followed by the id of the element.
  • Class Selector: The class selector selects HTML elements with a specific class attribute. To select elements with a specific class, write a period (.) character, followed by the class name.
SelectorExampleExample description
#id#firstnameSelects the element with id= “first name”
.class.introSelects all elements with class=”intro”
element.classp.introSelects only <p> elements with class=”intro”
**Selects all elements
elementpSelects all <p> elements
element.elementdiv, pSelects all <div> elements and all <p> elements

How to add CSS?

There are 3 ways to add CSS

  1. External CSS: With an external css we change the look of the website with changing one file. External CSS are defined inside the <link> tag.
  2. Internal CSS: An internal style sheet may be used if one single HTML page has a unique style. The internal style is defined inside the <style> element, inside the head section.
  3. Inline CSS: An inline style may be used to apply a unique style for a single element. To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property.

CSS Comments: Comments are used to explain the code. These are used for later purpose to correct the source code. These comments are given inside the <style> attribute and starts with /* and ends with */.

CSS Borders:

CSS Borders allow to specify the style, width and color of the elements border

  • dotted- Defines a dotted border
  • dashed – Defines a dashed border
  • solid – Defines a solid border
  • double – Defines a double border
  •  groove- Defines a 3D grooved border. The effect depends on the border-color value
  • ridge – Defines a 3D ridged border. The effect depends on the border-color value
  • inset – Defines a 3D inset border. The effect depends on the border-color value
  • outset – Defines a 3D outset border. The effect depends on the border-color value
  • none – Defines no border
  • hidden – Defines a hidden border

Related Posts

Smarter Medical Travel Planning with MyMedicPlus Healthcare Assistance

Navigating the international medical landscape can often feel like an overwhelming, uphill battle for individuals seeking specialized clinical treatment. Fortunately, the emergence of advanced digital health ecosystems…

Read More

Smarter Hospital Selection With MyHospitalNow and Cost Transparency

Introduction Imagine sitting at your kitchen table late at night, staring at a medical diagnosis or a recommendation for an upcoming surgery. Your mind immediately floods with…

Read More

Accelerating Your Engineering Impact with the Certified FinOps Professional Certification

Introduction In the rapidly evolving landscape of cloud-native infrastructure, managing cloud expenditure has become as critical as maintaining system uptime. The Certified FinOps Professional certification offers a…

Read More

Step-by-Step Tutorial: Reset WordPress Admin Password Using WP-CLI Commands

What is WP-CLI? WP-CLI is the command-line tool for managing WordPress without opening the browser. You can manage users, plugins, themes, database, cache, posts, and even reset…

Read More

Understanding the Value of the Certified FinOps Manager for DevOps Professionals

Introduction In the current landscape of cloud-native infrastructure, managing costs has transitioned from a back-office accounting task to a core engineering responsibility. The Certified FinOps Manager credential…

Read More

Best Travel Forum to Ask Questions & Plan Trips | HolidayLandmark

The Shift from Search Bars to Community Chats Imagine planning a two-week dream vacation to Tokyo. You type your query into a traditional search engine, and you…

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x