• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

id

Page history last edited by PBworks 17 years, 6 months ago


 

Description

 

An id is an HTML property useful for defining an individual element. It is set as follows:

 

<tag id="label">...</tag>

 

where "tag" is any HTML tag (div, span, table, etc.) and "label" is the unique name for that element. NOTE: That means that only ONE element can have any given id.

 

The id does not affect the HTML of the page in any way. Instead, it is an identifier to be used in CSS or Javascript, as shown below.

 

CSS Application

 

The main use of the id for most people is to modify specific elements of a PBwiki-generated HTML document. For example, the user content area of a wiki page is roughly defined as follows:

 

<div id="displaycontent"
   <div id="SideBar">
      ...SideBar content..
   </div>

   ...page content...

</div>

 

To modify the styles for these pages, one sets the selector for the CSS declaration to the id, preceded by a # (pound sign), as follows:

 

#displaycontent { background:#CCCCCC; }

 

That declaration says, "set the background of the element with the id 'displaycontent' to the color #CCCCCC (light gray)."

 

Javascript Application

 

For dynamic content, you can use Javascript to access the element and change its styles. Although this is mostly out of the scope of this wiki, here is a simple example:

 

<script type="text/javascript">
document.getElementById("SideBar").style.width = '150px';
</script>

 

This tells the Javascript interpreter to find the element with the specified id and then to set its width property.

 

See Also

selector

Comments (0)

You don't have permission to comment on this page.