Answers for "basic html css"

5

adding css to html body

Three ways to add CSS to the body of html:
	1)External CSS
	2)Internal CSS
	3)Inline CSS

1) Externally:  
    Type your css code in a file. Remember you file name.
	Then,
<head>
	<link rel="stylesheet" type="text/css" href="FileName.css" >
</head>

2) Internally:
	Type your cSS in the html file itself. (It is not preffered until
	little CSS code is to be added). This can be done by style tag.
	Example:
	<head>
	<style>
	h1 {
      text-color:red;
      text-size: 0.8em;
    }
    </style>
	</head>

3) Inline:
	This method is not used by developers as it is very lengthy and
	maintaining code becomes difficult.
	Example:
   <h1 style="color:blue;text-align:center;">Header file</h1>
Posted by: Guest on June-06-2020
0

basic css

<html>
<head>
<title>TAG index</title>

<style type="text/css">

.example a:link { color: #0000ff; }
.example a:visited { color: #0000a0; }
.example a:hover { color: #ff0000; }
.example a:active { color: #ffff00; }

</style>

</head>
<body>

<ul class="example">
<li><a href="../../index.html">The styles are applied to this link.</a></li>
<li><a href="../index.html">The styles are applied to this link.</a></li>
<li><a href="index.html">The styles are applied to this link.</a></li>
</ul>

<ul>
<li><a href="../../index.html">The styles are not applied to this link.</a></li>
<li><a href="../index.html">The styles are not applied to this link.</a></li>
<li><a href="index.html">The styles are not applied to this link.</a></li>
</ul>

</body>
</html>
Posted by: Guest on April-20-2021

Browse Popular Code Answers by Language