WebListStyle

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

WebListStyle sets how a list looks: the marker before each item (discs, numbers or none), whether markers sit outside or inside the items' text, and the space on the list's left. Anything not set writes nothing, so the list keeps the site's starting look for it. It can be set on a bulleted or a numbered list.

Example Code

use Libraries.Web.Page.all
use Libraries.Web.Styles.WebListStyle

class Main is WebPage
    action Main
        WebListStyle bullets
        bullets:UseDiscs()
        bullets:MarkersOutside()
        bullets:SetLeftPadding(32)

        UnorderedList list
        SetStyle(list, bullets)
        list:AddListItem("First")
        Add(list)
    end
end

Actions

Copy()

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

Returns

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

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle bullets
bullets:UseDiscs()
WebListStyle roomy = bullets:Copy()
roomy:SetLeftPadding(48)

Generate()

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

Returns

text: The declarations for this style.

GetLeftPadding()

Returns the space on the list's left, in pixels, or -1 if it was never set.

Returns

number: The left padding, in pixels, or -1.

HasMarkersInside()

Puts no marker before the items.

Returns

boolean

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:UseNoMarker()

HasMarkersOutside()

Places the markers outside the items' text, so wrapped lines line up with the first line's text, not the marker.

Returns

boolean

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:MarkersOutside()

MarkersInside()

Places the markers inside the items' text, so wrapped lines line up under the marker.

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:MarkersInside()

MarkersOutside()

Places the markers outside the items' text, so wrapped lines line up with the first line's text, not the marker.

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:MarkersOutside()

SetLeftPadding(number pixels)

Sets the space on the list's left, in pixels. The markers sit in this space when they are outside the text.

Parameters

  • pixels number: The space on the left. It can't be negative.

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:SetLeftPadding(32)

UseDiscs()

Puts a disc before each item.

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:UseDiscs()

UseNoMarker()

Puts no marker before the items.

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:UseNoMarker()

UseNumbers()

Puts a number before each item: 1, 2, 3 and so on.

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:UseNumbers()

UsesDiscs()

Returns the space on the list's left, in pixels, or -1 if it was never set.

Returns

boolean: The left padding, in pixels, or -1.

UsesNoMarker()

Places the markers inside the items' text, so wrapped lines line up under the marker.

Returns

boolean

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:MarkersInside()

UsesNumbers()

Sets the space on the list's left, in pixels. The markers sit in this space when they are outside the text.

Returns

boolean

Example

use Libraries.Web.Styles.WebListStyle

WebListStyle style
style:SetLeftPadding(32)

Inherited Actions

3 actions from Libraries.Language.Object