table border attribute

  • Thread starter Thread starter rodchar
  • Start date Start date
R

rodchar

hey all,
is it possible to make the table border attribute dynamic? For example, is
there a way to make it where i can set it in a style sheet?

thanks,
rodchar
 
Sure, just use the CSS border property. For example:

<table style="border:2px solid black;">

would give the table a solid black border with a width of 2px. You can
obviously also use the other CSS border properties, such as border-width,
border-style, border-color, etc. Something that I often do when modifying
borders in tables is place the styles for the borders in the individual td
tags so that I can do more customization for the table's appearance, but
this can depend on your specific situation.
 
You could dynamically add text to a stylesheet so that you can change the
border style based on some arbitrary logic. Style1.InnerText += "table {
border: solid 1px black; }". That works well if you are using master pages
and content pages. (Style1 is the id of the style element.)

Sam
http://dotnetperls.com/
 
Back
Top