【问题标题】:How do I add src and class to a Html.img in Elm?如何在 Elm 中将 src 和类添加到 Html.img?
【发布时间】:2021-07-09 23:08:23
【问题描述】:

我在 Elm 中有一个 Html.img,我想在其中添加 srcclass。我怎么做?谢谢!

【问题讨论】:

    标签: html image class elm src


    【解决方案1】:
    import Html exposing (img, div)
    import Html.Attributes exposing (class, src)
    
    
    view : Model -> Html Msg
    view model =
        div []
            [ img [ class "my-img", src "https://loremflickr.com/320/240" ] []
            ]
    

    查看实时示例here

    或者阅读更多关于Html.Attributes的信息。

    【讨论】:

      猜你喜欢
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 2016-05-02
      • 2021-07-18
      • 2022-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多