Elm中段落的宽度
width of paragraph in Elm
试图使段落具有一定的宽度,但段落超出了。为什么 Elm 不理我?
那个宽度必须是一个整数,所以我给了它宽度以像素为单位。
import Html exposing (..)
import Html.Attributes exposing (..)
info : String
info = "Ports must be careful about what values are allowed through. Elm is statically typed, so each port is fitted with some border protection code that ensures that type errors are kept out. Ports also do some conversions so that you get nice colloquial data structures in both Elm and JS."
main = p [ Html.Attributes.width 500] [ text info ]
Elm-Reactor 只是将其编译为 <p> ... </p>
没有属性。
使用 Html.Attributes
中的“风格”
style [ ("width", "100px") ]
根据文档,“Html.Attributes.width”函数不适用于段落。
width : Int -> Attribute msg
Declare the width of a canvas, embed, iframe, img, input, object, or video.
http://package.elm-lang.org/packages/elm-lang/html/1.0.0/Html-Attributes#width
您将 width
HTML 属性与同名 CSS 属性 混淆了。
width
For the elements listed here, this establishes the element's width.
Note: For all other instances, such as , this is a legacy attribute, in which case the CSS width property should be used instead
<canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video>
CSS 属性
p [ style [ ("width", "100px") ] ] [ text "Hello World!" ]
-- <p style="width: 100px">Hello World</p>
HTML 属性
iframe [ width 100 ] []
-- <iframe width="100px"></iframe>
试图使段落具有一定的宽度,但段落超出了。为什么 Elm 不理我?
那个宽度必须是一个整数,所以我给了它宽度以像素为单位。
import Html exposing (..)
import Html.Attributes exposing (..)
info : String
info = "Ports must be careful about what values are allowed through. Elm is statically typed, so each port is fitted with some border protection code that ensures that type errors are kept out. Ports also do some conversions so that you get nice colloquial data structures in both Elm and JS."
main = p [ Html.Attributes.width 500] [ text info ]
Elm-Reactor 只是将其编译为 <p> ... </p>
没有属性。
使用 Html.Attributes
中的“风格”style [ ("width", "100px") ]
根据文档,“Html.Attributes.width”函数不适用于段落。
width : Int -> Attribute msg
Declare the width of a canvas, embed, iframe, img, input, object, or video.
http://package.elm-lang.org/packages/elm-lang/html/1.0.0/Html-Attributes#width
您将 width
HTML 属性与同名 CSS 属性 混淆了。
width
For the elements listed here, this establishes the element's width.
Note: For all other instances, such as , this is a legacy attribute, in which case the CSS width property should be used instead
<canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video>
CSS 属性
p [ style [ ("width", "100px") ] ] [ text "Hello World!" ]
-- <p style="width: 100px">Hello World</p>
HTML 属性
iframe [ width 100 ] []
-- <iframe width="100px"></iframe>