css - Bootstrap 选项卡可以显示代码吗?

标签 css twitter-bootstrap-3

我想使用 Bootstrap 面板和选项卡来显示图像,然后在选项卡上显示代码。我怎样才能做到这一点?我正在用 haml 写作。使用 pre 和 code 标签的正确方法是什么?当我执行此操作时,HTML 中的代码会执行表单,但我只想展示我使用的代码如何执行此操作。

谢谢

enter image description here

    .col-md-4
      .panel.panel-default
        .panel-body
          .container
            %ul.nav.nav-tabs
              %li.active
                %a{:href => "#home"} Preview
              %li
                %a{:href => "#menu1"} HTML
              %li
                %a{:href => "#menu2"} HAML
            .tab-content
              #home.tab-pane.fade.in.active
                .col-md-3
                  %img{:alt => "Forms", :src => image_path('form.png'), :style => 'width: 100%; height: auto;'}  
              #menu1.tab-pane.fade
                %h3 HTML
                %pre
                  %code
                    %p
                      <div class="section section-form">
                      <div class="section-head">Form</div>
                      <div class="section-body">
                      <form>
                      <div class="form-group">
                      <label for="exampleInputEmail1">Email address</label>
                      <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                      </div>
                      <div class="form-group">
                      <label for="exampleInputEmail1">Email address</label>
                      <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email" disabled>
                      </div>

最佳答案

明白了

               %pre
                  %code
                    :ruby
                      html = <<-HTML
                        <div class="section section-form">
                        <div class="section-head">Form</div>
                        <div class="section-body">
                        <form>
                        <div class="form-group">
                        <label for="exampleInputEmail1">Email address</label>
                        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                        </div>
                        <div class="form-group">
                        <label for="exampleInputEmail1">Email address</label>
                        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email" disabled>
                        </div>
                      HTML
                    = html

关于css - Bootstrap 选项卡可以显示代码吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32196998/

相关文章:

html - 在较小的屏幕上展开元素的高度

javascript - 如何响应 "shown.bs.collapse"事件?

css - img div 无法在移动设备上运行

joomla 1.5模板中的CSS定位

javascript - 在 jQuery 悬停时移动 div 背景位置

jquery - 如何一步步改变颜色

html - bootstrap v3.3.2 - col-xs-* 不在小屏幕上显示

html - 在 Bootstrap 中创建隐藏文本(然后显示它)?

HTML布局问题...

html - 为什么输入框在以 100% 宽度填充后会超出 div 框