Select Menu

Combined Post

Mag Posts

Theme images by konradlew. Powered by Blogger.

Blogger templates

Blogger news

Facebook

Advertising

Blogroll

Popular Posts

Combined Posts 2

Mag Post 2

2 Column Post

Simple Post

Simple Post 2

New Carousel

Video Posts

» »Unlabelled » Introduction to CSS (Cascade Style Sheet)


SLVIKI 6:48 AM 0



Can we me make a web page by only using HTML? no we can not make a web page by only using HTML. What we can do using HTML is make the structure of the web page. Yes, We use HTML only to make the structure of the web page. So how can we make a web page like web pages we can see in our  day today life. That is possible using CSS. What is CSS? The term CSS is for Cascade Style Sheet. In order to style our page structure that we built using HTML we have to build a CSS document and link it to out HTML document or otherwise build CSS document inside the HTML document. Normally we build the CSS document outside the HTML document (as a new document) and then link that document to the HTML document. In that way we will be able to use same CSS document for Different web pages. In building style sheet inside the HTML document there are two methods, we can add the style methods directly to the HTML elements or we can Build a Style sheet internally inside the HTML document.  And the newest version of CSS is CSS3.

OK, now lets see how to style our web page by adding styles to an HTML element.

this is a sample code of adding styles to an HTML element,


And this is the output looks like.

As you can see in the second <p> element I have added some styles. So in the out put the text are bold in the second text. When we add the styles internally it's called inline style or inline css. we can add inline css to any html element.

Now lets look at how to add  Internal style sheet to the HTML document. We can add a style sheet internally to the html document by adding a <style> tab inside the <head> element. Lets see an Example code



And the output of the above code will be like this.



So it is not so complicated to add a style sheet internally. By this way we can design a complete style sheet to work for the web page that the css is in.

not lets look at how to add a style sheet externally. In order to do that we have to make a another document and put our css code inside it then we have to save it in .css extension. the saving destination will be differ according to your desire but i recommend you  to save the css file inside the file where you save the html file. so it is easy handle the web page.

now lets see how to add a css file externally to the html file. to link the css file to your html document we can use this syntax inside the <head. element of your html document.

<link rel=”stylesheet” type=”text/css” href=”your_css_file_address_with_name .css”>

Now lets look at an Example code

this is the mywebpage.html file


if you want to add href="style.css" same as that it is important to save the style.css file in the same directory as mywebpage.html.

this is  the example style.css file,


and this is the output which will looks like the same as before.



so this is the basic of css I will talk about more about css in the upcoming posts. just you have to do is subscribe this blog ad stay in touch with me.

«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply