Learning CSS Part 4 : Rules and Way of Writing CSS Code

0

CSS (Cascading Stylesheets) is a web programming language that has a function and purpose to set up or design each component of HTML.

After studying the sense of the selector, property, and value from the previous tutorials on CSS, CSS tutorials within this time we will learn Learning CSS Part 4: rules and way of writing CSS code.

Using the CSS selector (id and class) to determine the element that you want to modify or to give a touch of CSS. If in say HTML as a pillar in the House, then building a CSS function as paint and decorations on buildings. There are three methods of writing CSS techniques, namely:

  • Inline CSS Style
  • Internal CSS Style
  • External CSS Style

Example of writing inline CSS style

Examples Of Learning Basic CSS Way Of Writing CSS. To make an example of writing CSS inline style do I provide an HTML or PHP files. Here I’m using HTML. I created a file with the name index.html.

Note in the example above. the CSS syntax in place in h1 element using an attribute style = “”. CSS color commands are commands that function to set the font color. so in the example inline CSS style, we made with h1 headings font color that we set into blue (blue).

example of writing css inline style

Internal CSS Style writing techniques

The technique of writing CSS syntax with the Internal style is the technique of writing css syntax in place of one file with the html file or php files. the CSS syntax in put in his usual <style> dan di akhiri dengan tag </style> tag. <style> .. </style> in the tag put on the tag<head>on HTML.

An example of writing an internal CSS Style

Note the internal CSS style writing example above. the CSS syntax in place of one file with the HTML file. the CSS syntax in place inside the tag. the syntax of CSS padding function as a regulator of the distance on the sides in the element. in this example, we give the distance of 10px or 10 pixels. calling CSS selector class with a dot “.” and calling the selector id with the sign “#”.

See the Pen Internal CSS style writing by webspoints (@webspoints) on CodePen.

The technique of writing CSS External Style

Learning Basic CSS techniques are a way of writing CSS. The technique of writing CSS Syntax with the External Style is a technique of writing separate CSS files and HTML. a good use of CSS is to use the technique of writing CSS code is because we are not going to fall apart because of the CSS syntax stored in the CSS file. the CSS files and HTML in the connect using

Example of writing CSS using External Style

webspoint
Learn The Basic Way Of Writing CSS CSS

index.html

style.css

See the Pen Writing CSS using External Style by webspoints (@webspoints) on CodePen.

For the next CSS tutorial, we will be dissected in detail about CSS Selector in CSS Learning Tutorial Part 5: getting to know the kinds of Basic CSS Selector.

LEAVE A REPLY

Please enter your comment!
Please enter your name here