Wednesday, July 10, 2013

Set style via class versus id for an element in a web page

Suppose the following is defined in the header of a web page:

<head>
<style type="text/css">
#this_id
{
    border:2px solid;
  border-radius:25px;}
.this_class
{
   border:2px solid;
   border-radius: 25px;
}
</style>
</head>

"this_id" will be specifying the style for an element with id set to "this_id" while "this_class" will be specifying the style for an element with class name set to "this_class". For example

<body>
<div class="this_class">Some class styled content</div>
<div class="this_id">Some id styled content</div>
</body>

No comments:

Post a Comment