10. CSS
10. CSS
----------------
CSS
---
Ex:
<html>
<head>
<style>
p{
text-align : center;
</style>
</head>
<body>
<p>I am paragraph1</p>
<p>I am paragraph2</p>
....
<p>I am paragraph10</p>
</body>
</html>
-------------
- element selector
Ex:
h3 {
text-align : center;
color : red;
- id selector
specific element
- class selector
- the class selector restricts that the styles need to be used by the specific
- grouping selector
Ex:
h3 {
text-align : center;
color : blue;
}
h4 {
text-align : center;
color : blue;
p {
text-align : center;
color : blue;
After grouping,
h3 , h4, p {
text-align : center;
color : blue;
---------------------
- the styles are used only within the same HTML file
- the styles are defined using "style" attribute along with the HTML element
- the styles are used only within the same HTML element
Refer programs
- externalCSS.html
XML
---
- XML is used to transport the data from one application to another application
- In Java, XML is used to create configuration files required for the application
HTML vs XML
-----------
- In HTML, all tags are predefined tags where as in XML all tags are used defined tags
- HTML is used to present the data where as XML is for data about data (META-DATA)
Ex:
---------
- A XML file should contain only one root tag (the first tag in XML file is root tag)
- For every tag there should be a closing tag or self enclosing tag
Ex:
<mytag>...</mytag>
or
Ex:
- No overlapping of tags
Ex:
JSON
----