HTML button opening link in new tab

前端 未结 8 1288
挽巷
挽巷 2020-12-05 17:32

So this is the simple code for the button to open a certain link

                
8条回答
  •  攒了一身酷
    2020-12-05 17:44

    If you're in pug:

    html
        head
            title Pug
        body
            a(href="http://www.example.com" target="_blank") Example
            button(onclick="window.open('http://www.example.com')") Example
    

    And if you're puggin' Semantic UI:

    html
        head
            title Pug
            link(rel='stylesheet' href='https://cdn.jsdelivr.net/npm/semantic-ui@2.3.3/dist/semantic.min.css')
        body
            .ui.center.aligned.container
                a(href="http://www.example.com" target="_blank") Example
            .ui.center.aligned.container
               .ui.large.grey.button(onclick="window.open('http://www.example.com')") Example
    

提交回复
热议问题