how to link css files to html page with p, .class1,#my id selectors

Posted by Manideepgoud under HTML 5 on 6/16/2015 | Points: 10 | Views : 753 | Status : [Member] | Replies : 3
how to apply css codes p,.class1 and #myid and where to add to html page




Responses

Posted by: A2H on: 6/16/2015 [Member] [MVP] Silver | Points: 25

Up
0
Down
Are you looking for an option to link external css stylesheet to your page. If so then you can use the Link tag to add the style sheet to your page. You can put this tag inside the head tag of your page
<link href="/styles/CommonStyles.css" rel="stylesheet" type="text/css" />

Change the style sheet path accordingly.

Thanks,
A2H
My Blog

Manideepgoud, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Purvi on: 10/10/2019 [Member] Starter | Points: 25

Up
0
Down
Styles can be linking to an HTML document using one of three methods:

1. Inline Style

Example:

<html>
<body>
<p style="color: #0000FF">
Instyle Paragraph Testing
</p>
<p>
Another Paragraph Testing
</p>
</body>
</html>


The above declaration will ensure that the paragraph text will be blue. This method can be applied to any HTML element within the < body > .... < /body > of the HTML page.



2. Embedded Style

Embedded Styles allow you to implement any number of CSS styles by placing them between the opening and closing <style></style> tags.

You can place Style Tag within the < head > ... < /head > section, just after the < title > tag of your HTML page.

<head>
<style>
........
........
</style>
</head>


The opening Style tag should always use the attribute "type". The attribute value is "text/css" in the case of a CSS document.

Example:

<html>
<head>
<title>Embedded Style Sample</title>
<style type="text/css">
h1{
color: #0000FF;
}
h2{
color: #00CCFF;
}
</style>
</head>
<body>
<h1>Embedded Style testing</h1>
<h2>Next Line</h2>
</body>
</html>



3. External Style


An external style sheet is a plain text file that contain CSS Style formats only. The extension of the external file should end with .css extension (e.g. pagestyle.css). This external file is referred to as an external style sheet.

The external Style Sheet (.css file) always seperate from HTML file. You can link this external file (.css file) to your HTML document file using the < link > tag . You can place this < link > tag Within the < head > section, and after the < title > element of your HTML file.


<link rel="stylesheet" type="text/css" href="styles.css" />



for more information you can go through following link:

https://www.w3schools.com/css/css_howto.asp



Manideepgoud, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pritambhatta on: 10/11/2019 [Member] Starter | Points: 25

Up
0
Down
Great Information was very useful for me..

Manideepgoud, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response