This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

ItemStyle

ItemStyle
is an option for Grid, Column and related constructs that specifies styles to use for items.
  • ItemStyle->s specifies that all items should use style specification s.
  • Item style specifications can include all options to Item, as well as options to Style. Directive[opt1, opt2, ...] can be used to specify multiple options.
  • Item style specifications are applied to the complete region of an item, not just its contents, so that, for example, backgrounds extend to the edge of the item.
  • The settings for ItemStyle can be given as follows to apply separately to different items:
specapply spec to all items
{specx}apply specx at successive horizontal positions
{specx,specy}apply speck at successive horizontal and vertical positions
{spec_(x),spec_(y),rules}also allow explicit rules for individual i, j elements
  • The speck can have the following forms:
{s1,s2,...,sn}use s1 through sn; then use defaults
{{c}}use c in all cases
{{c1,c2}}alternate between c1 and c2
{{c1,c2,...}}cycle through all ci
{s,{c}}use s, then repeatedly use c
{s1,{c},sn}use s1, then repeatedly use c, but use sn at the end
{s1,s2,...,{c1, c2, ... }, sm, ... , sn}
use the first sequence of si at the beginning, then cyclically use the ci, then use the last sequence of si at the end
{s1,s2,...,{},sm,...,sn}use the first sequence of si at the beginning and the last sequence at the end
{i1->v1,i2->v2,...}specify what to use at positions ik
{spec,rules}use rules to override specifications in spec
  • If multiple speci or rules specify styles for a particular element, the styles are combined in the order they appear.
Style all the elements in the grid:
Style the first row:
Use a style from the current stylesheet:
Style all the elements in the grid:
In[1]:=
Click for copyable input
Out[1]=
 
Style the first row:
In[1]:=
Click for copyable input
Out[1]=
 
Use a style from the current stylesheet:
In[1]:=
Click for copyable input
Out[1]=
Blue and red font colors for the first and second horizontal positions:
Blue and red font colors for the first and last horizontal positions:
Blue and red font colors for the first and second vertical positions:
Alternating blue and red font colors:
Alternating font colors with orange superimposed in the first and last positions:
Style specific elements:
Style a region:
Overlapping specifications are unified when possible:
BaseStyle can be used to specify a style for the entire grid:
Column styles have precedence over row styles:
Use Directive to wrap multiple style directives:
New in 6