WebTableStyle

Package: Libraries.Web.Styles · Inherits from: Libraries.Language.Object, Libraries.Web.Styles.WebStyle

WebTableStyle sets how a table as a whole is laid out: whether it fills the width it is in, whether its columns share that width evenly, and whether neighboring cells share one border instead of two. Anything not set writes nothing, so the table keeps the site's starting look for it. Styles for a table's parts, such as its header row or cells, come later.

Example Code

use Libraries.Web.Page.all
use Libraries.Web.Styles.WebTableStyle

class Main is WebPage
    action Main
        WebTableStyle wide
        wide:SetFullWidth(true)
        wide:SetEvenColumns(true)
        wide:SetSharedBorders(true)

        WebTable table
        SetStyle(table, wide)
        Add(table)
    end
end

Actions

Copy()

Returns a new table style with the same settings. Change the copy to give one table its own look without changing every table that shares this style.

Returns

Libraries.Web.Styles.WebTableStyle: A copy of this style.

Generate()

Returns the stylesheet declarations for this table style. WebSite calls this when it writes the stylesheet; people making pages don't.

Returns

text: The declarations for this style.

HasEvenColumns()

Removes the space browsers leave between cells when they don't share borders, so the cells touch. With rounded corners on the table, this is how the corners round the cells too.

Returns

boolean

Example

use Libraries.Web.Styles.WebTableStyle

WebTableStyle style
style:SetSharedBorders(false)
style:RemoveCellSpacing()

HasSharedBorders()

Sets whether neighboring cells share one border instead of each drawing its own.

Returns

boolean

Example

use Libraries.Web.Styles.WebTableStyle

WebTableStyle style
style:SetSharedBorders(true)

IsFullWidth()

Sets how the table looks as a box: its rounded corners, shadow and background. A table has one style, so its box goes here.

Returns

boolean

Example

use Libraries.Web.Styles.WebTableStyle
use Libraries.Web.Styles.WebBoxStyle

WebBoxStyle card
card:SetRoundedCorners(8)
card:SetShadow(true)
WebTableStyle style
style:SetBox(card)

RemoveCellSpacing()

Removes the space browsers leave between cells when they don't share borders, so the cells touch. With rounded corners on the table, this is how the corners round the cells too.

Example

use Libraries.Web.Styles.WebTableStyle

WebTableStyle style
style:SetSharedBorders(false)
style:RemoveCellSpacing()

SetBox(Libraries.Web.Styles.WebBoxStyle style)

Sets how the table looks as a box: its rounded corners, shadow and background. A table has one style, so its box goes here.

Parameters

Example

use Libraries.Web.Styles.WebTableStyle
use Libraries.Web.Styles.WebBoxStyle

WebBoxStyle card
card:SetRoundedCorners(8)
card:SetShadow(true)
WebTableStyle style
style:SetBox(card)

SetEvenColumns(boolean value)

Sets whether the columns share the table's width evenly, whatever is in them. Without this, wider content makes a wider column.

Parameters

  • value boolean: True for even columns.

Example

use Libraries.Web.Styles.WebTableStyle

WebTableStyle style
style:SetEvenColumns(true)

SetFullWidth(boolean value)

Sets whether the table fills the whole width it is in.

Parameters

  • value boolean: True to fill the width.

Example

use Libraries.Web.Styles.WebTableStyle

WebTableStyle style
style:SetFullWidth(true)

SetSharedBorders(boolean value)

Sets whether neighboring cells share one border instead of each drawing its own.

Parameters

  • value boolean: True for shared borders.

Example

use Libraries.Web.Styles.WebTableStyle

WebTableStyle style
style:SetSharedBorders(true)

Inherited Actions

3 actions from Libraries.Language.Object