HTML and CSS Reference
In general, you can open an html file in a browser without using IIS. For example, you
could rename the Index.cshtml file in your Visual Studio project to Index.html and
simply open the file with Internet Explorer (or any browser) and the page would work
fine. However, .htc files are ignored if the page is not actually served up by a web server
such as IIS or Apache.
You may need to define the HTC content type on your web server. IIS and IIS Express both
support this by default but you may need to add this with Apache or other web servers.
.htc file is typically referenced in a CSS file, the URL specified in the
behavior attribute must be relative to the location of the html document that invoked the
style sheet. If you put the .htc file in the Content folder (with all the other style sheets),
you'll need to reference it with a relative path ~/Content/customBehavior.htc .
To display tables you will use an open-source HTC that can be downloaded from this site:
Even though the
eXerCISe 7-2. SUppOrtING taBLeS
download the latest .zip file from this site: http://tanalin.com/en/projects/
11-25.zip.) This file contains an uncompressed and a minimized version. Copy the
display-table.htc to the Content folder.
Right-click the Content folder and select the Add ➤ Existing item links. Browse to
the Content folder and select the display-table.htc file. Click the Add button to
load the file.
open the Index.cshtml and find the portion where the table is defined. Add
the code shown in bold from listing 7-1 to the existing style rules. This specifies
a vendor-prefixed version of the display attribute and invokes the
Listing 7-1. Defining a new table
/* Setup a table for the content and sidebar */