How to Add CSS to an HTML Page with the style Element
The <style> element holds CSS inside the HTML page itself. Put it in head, write your CSS rules between its tags, and they apply to that page.
HTML, the Markup Language of Web Pages, with Elements, Attributes and Forms
View All TagsThe <style> element holds CSS inside the HTML page itself. Put it in head, write your CSS rules between its tags, and they apply to that page.
The class attribute puts elements into a named group. One CSS rule for . and that name then styles every element in the group, and one element can belong to several groups.
The id attribute gives one element a name that no other element on the page has. CSS can style it with # and that name, scripts can find it by it, and a link ending in # and the name jumps to it.
A <div> is a box with no meaning and no look of its own. Put elements inside it to group them, and you can style the whole group at once, for example with a border, or reach it from a script.
Each <p> element is one paragraph. The browser puts space above and below it, and wraps its text to fit the window, ignoring the line breaks you typed in your code.
Wrap words in <strong> and the browser shows them in bold. Bold is how browsers show what strong means: that the words are important.
A <ul> with one <li> for each item makes a bulleted list: the browser draws a bullet in front of every item and indents the list from the text around it.
An HTML table is a <table> made of rows, <tr>, and each row is made of cells: <th> for a header cell and <td> for a data cell. The browser lines the cells up into columns for you.
<textarea> is a text box for more than one line, for things such as comments, messages and addresses. Pressing Enter in it starts a new line instead of sending the form.
Add hidden to any element and the browser doesn't show it. The element stays in the page's code, so a script can show it later, but until then nobody sees it, including people who use screen readers.