Applying Styles to child selectors in CSS
This Concept is very useful if you ever tried to apply styles child elements of parent.
for example,lets have a program .I defined my text in <strong> element as a single selector as well as a child selector of a <div> element.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Css demo</title>
<style type="text/css">
strong
{
background-image: url('images/back10.jpg');
font-size: 200%;
text-decoration: underline;
}
div > strong / * child selector*/
{
font-size: 300%;
text-decoration: none;
color:yellow;
}
</style>
</head>
<body>
<center><strong>this is a data taken as an example</strong></center>
<br>
<br>
<div>
<strong>this text defined in a division tag ,which is called as a parent to this element </strong>
</div>
</body>
</html>
output:
Không có nhận xét nào:
Đăng nhận xét