search
[last updated: 2024-01-25
Drupal home page
CSS example code
CSS Rule selectors:
HTML
CSS in Drupal
-----
--------------------------------------------------------------------------------
CSS rules supply the Style/formatting of a webpage.
They instruct the browser to render the desired "look and feel" of the page, including such things as size, color, and placement of all elements on the page, whether text, images, or whatever.
They also specify function, whether movements of the elements on the page, or responses to mouse or keyboard input.
CSS = "Cascading Style Sheets". The name 'cascading' refers to a behavior of the system in which multiple rules might apply to a given element, and which rule actually gets rendered depends on the cascading priority which evaluates where the rules are placed and exactly how their syntax is constructed (more later...).
--------------------------------------------------------------------------------
The 'property' is the parameter of the element you're specifying, eg. color, position, etc.
The 'value' is the specific setting of the property, eg. red, or 4px, etc.
h1 { color: red; }
In this example, "h1" is the selector, "color" is the property, and "red" is the value.
The property and value are separated by a colon.
The value is followed by a semicolon.
The property and value are enclosed in curly braces.
------------------------------------
<head>
<style>
body {background-color: pink;}
h1 {
color: red;
text-align: center; }
</style>
</head>
<p style="color:red;">Text here is red.</p>
or:
<p style="color:red; border:1px solid black;">Text here is red, and it has a black border.</p>
<head>
<link rel="stylesheet" href="[put the url of your first css file here ...] ">
<link rel="stylesheet" href="[put the url of your second css file here ...] ">
</head>
The url of the css file is specified in relation to the directory where your html file is located.
-or-
you can import a second css file directly into your first by placing this line in your first css file:
@import "style2.css";
To summarize: external CSS files are text files with a list of rules like those in the examples above.
------------------------------------
h1 {
color: red;
border: 1px solid black;
}
or:
h1 { color: red; border: 1px solid black; }
h1 { color: red; }
h1 { border: 1px solid black; }
------------------------------------
This description is still a bit sketchy/ambiguous...
--------------------------------------------------------------------------------
eof