
CSS is not a replacement for markup, instead it can only be used to style HTML. Will render the same as h1īefore we move ahead, it should be noted that even though CSS and HTML together make a great team, CSS is distinct from HTML and infact relies on it. Super lightweight less than 4 KB in size. Use a maximum of 3 to 4 color Make Website Responsive (Fite in any screen sizes devices) Try To use the same sizes and font family for text. Sensible defaults that format standard HTML elements. To make a website beautiful and attractive you need to follow the following steps: Take simple colors for your website. Also, do keep in mind that CSS is not whitespace sensitive, hence Simple.css includes the following right out the box: A good looking sans-serif local font stack. However, for good measure and easy insertion of properties later, always consider using semicolons after all the properties.ĬSS property names are separated by dashes when they use multiple words, example: font-face, line-height, font-size, etc. Note: The final declaration in a style block does not require a semicolon. Consider the example below showing the correct CSS syntax broken down to its individual components. Instead, we can create a style that binds itself to a particular element or a set of elements, which can be reused as required further. Such direct use of CSS is called Inline styling and which generally should be avoided due to its interference with the HTML tags, increase in HTML file size, and no reusability of the styles. For example to set the color and alignment of an h1 heading, we can use: Hello, CSS! property-nameN : valueN ĬSS rules can be placed directly within most HTML tags by using the style attribute. Phew! Let's look at this sentence more closely. Individual rules are terminated by semicolons, with the final rule having an optional semicolon. The color property, often known as color syntax, in CSS follows the basic syntax guideline we. Color Syntax: Color property in CSS is responsible for assigning the user-specified color to the text on the web page. CSS rules are defined as a property name followed by a colon and then a property value. In this section, well go over some CSS attributes and look at the syntax for using them with examples. As you probably already know, all programing languages have their own syntax, and while HTML and CSS aren't exactly programming languages, they do have their own syntax.ĬSS syntax is not much of a trouble. So let's have our first look at Cascading Style Sheets.
