How to add CSS in XML File ?
XML stands for Extensible Markup Language. It is a dynamic markup language. It is used to transform data from one form to another form.
In this article, we will discuss how to add CSS in the XML file. The CSS can be used to display the contents of the XML document in a clear and precise manner. It gives the design and style to a whole XML document.
Syntax
<?xml-stylesheet type="text/css" href="student.css"?>
Example 1: XML File
XML
<? xml version = "1.0" encoding = "UTF-8" ?> <? xml-stylesheet type = "text/css" href = "student.css" ?> < class > < heading >Welcome To GeeksforGeeks Class </ heading > < student > < name >Akshit</ name > < Address >Moradabad</ Address > < PhoneNumber >123456</ PhoneNumber > </ student > < student > < name >Nikita</ name > < Address >Lucknow</ Address > < PhoneNumber >876456</ PhoneNumber > </ student > < student > < name >Somya</ name > < Address >Delhi</ Address > < PhoneNumber >124556</ PhoneNumber > </ student > < student > < name >Eshika</ name > < Address >Meerut</ Address > < PhoneNumber >100056</ PhoneNumber > </ student > < student > < name >Kalpana</ name > < Address >Rampur</ Address > < PhoneNumber >1299456</ PhoneNumber > </ student > </ class > |
student.css
class{
color: white;
background-color : gray;
width: 100%;
}
heading {
color: green;
font-size : 40px;
background-color : powderblue;
}
heading,name,PhoneNumber,address {
display : block;
}
name{
font-size : 25px;
font-weight : bold;
}
Please Login to comment...