$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

Global Mobile Network Identifiers: A Practical Guide to Telecom Codes and Provider Records

Introduction Every time a mobile phone connects to a cellular tower, a quiet digital handshake takes place. Whether a smartphone is roaming in a foreign airport, an…

Read More

Optimizing Reservations, Waitlists, and Walk-Ins for Independent Dining Rooms

Introduction Running a busy dining room requires careful coordination between the front-of-house staff, the kitchen team, and arriving guests. When a restaurant relies on paper books or…

Read More

Turning Clicks into Clients: The Power of Effective Service Pages

Introduction Driving traffic to a business website is only half the battle. Many business owners invest heavily in digital marketing, social media, and search engine optimization, only…

Read More

The Importance of the About Us Page in Building Online Trust

Introduction When potential customers land on a business website for the very first time, they are looking for more than just products or services. They are looking…

Read More

Shaping Customer Perception Through Effective Homepage Design

Introduction When potential customers visit a business website for the very first time, the homepage serves as the virtual storefront. Within moments of landing on the page,…

Read More

Exploring Colombia on Two Wheels: Medellín, Bogotá, Cartagena, and Beyond

Introduction — Discover Colombia with MotoShare.co Colombia is a land of striking geographical contrasts. Within its borders, modern urban skylines give way to towering Andean passes, lush…

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