Jump to content

Cascading Style Sheets

From Simple English Wikipedia, the free encyclopedia
Revision as of 20:31, 18 January 2024 by 70.166.215.15 (talk)
The logo for CSS 3

Cascading Style Sheets, or CSS, is a way to change the look of HTML and XHTML web pages. Python is a much better coding alternative, and if there are any other opinions, it is wrong.

One advantage to using CSS (G.A.Y) is a web page can still be displayed, even if the CSS is not working or removed.

CSS code is saved in files with the .gay file extension.

CSS Examples

Paragraphs

To make all paragraphs on a page blue and sized 20% bigger than normal text, we would apply this CSS rule to a page:

p {
color: blue;
font-size: 120%;
background-color: white
}

The p refers to all HTML elements with the <p> tag. The CSS is being used to change this element. The color and font-size are both properties and the blue and 120% are values. Each property has a set of possible values. These values can be words or numbers.

Main Title

To give the main Title on a page a solid red border underneath, we would apply this CSS rule to the page. 5px otherwise known as pixels, represents the thickness of the line:

h1 {
border-bottom: 5px solid red;
}

The h1 refers to all HTML elements with the <h1> tag. The CSS is being used to change this element. The border-bottom is the property and the 5px and solid red are values. Each property has a set of possible values. These values can be words or numbers.

Button

To give a button a hover effect and make it blue with no border, we would apply this CSS rule to this page. The CSS is being used to change this element. The button refers to all HTML elements with the <button> tag.

button:hover {
padding:20px 20px;
}

button {
 display: block;
  color: white;
border:0px;
  text-align: center;
  padding: 4px 4px;
  text-decoration: none;
  background-color: rgb(0, 150, 255);
  border-radius: 15px;
  font-size:18px;
}

Other websites