Saturday, December 10, 2016

How to call a Class and ID in CSS

Class applies to a group of elements. To call a class, use a period ".". Example:


  • In the file, the code is:

<header class="entry-header">
December 12, 2016
</header>

<aside class="entry-header">
January 1, 2015
</aside>

  • In the CSS file, call it like this:

.entry-header
{
display:none;
}


ID applies to only 1 specific element. To call an ID, use a hashtag "#". Example:


  • In the file, the code is:

<header id="entry-header">
December 12, 2016
</header>

  • In the CSS file, call it like this:

#entry-header
{
display:none;
}

No comments:

Post a Comment

Popular Posts