如何混合class =" form-horizo​​ntal"使用引导形式的普通表单元素?

时间:2015-07-11 08:08:03

标签: twitter-bootstrap twitter-bootstrap-3

如何将单个表单中的class="form-horizontal"与不显示为水平的表单元素混合?该标记旨在根据documentation停留在<form> - 代码中。

冲突部分(form-horizo​​ntal-tag与表单的其余部分冲突:

    <form class="form-horizontal" role="form" action="/registrieren" method="post">
        <div class="row">
            <div class="col-md-2">
                    <label for="usr">Surname:</label>
                    <input type="text" class="form-control" id="vorname" name="vorname">
            </div>
            <div class="col-md-2">
                    <label for="usr">Name:</label>
                    <input type="text" class="form-control" id="name" name="name">
            </div>
        </div>
        <div class="row">
            <div class="col-md-3">
                    <label for="usr">Street:</label>
                    <input type="text" class="form-control" id="strasse" name="strasse">
            </div>
        </div>
</form>

工作水平表格:

 <form class="form-horizontal" role="form">
  <div class="form-group">
    <label class="control-label col-sm-2" for="email">Email:</label>
    <div class="col-sm-10">
      <input type="email" class="form-control" id="email" placeholder="Enter email">
    </div>
  </div>
  <div class="form-group">
    <label class="control-label col-sm-2" for="pwd">Password:</label>
    <div class="col-sm-10">
      <input type="password" class="form-control" id="pwd" placeholder="Enter password">
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <div class="checkbox">
        <label><input type="checkbox"> Remember me</label>
      </div>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-default">Submit</button>
    </div>
  </div>
</form>

我想把所有东西都放在一个单独的表格中,但姓氏和名字彼此相邻。

整个文件:

<!DOCTYPE html>
<html lang="De">
<head>
  <title>Titel</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h1>Titel</h1>
  <p>Bitte erfasse Deine persönlichen Angaben:</p>
  <form role="form" action="/registrieren" method="post">
    <div class="row">
            <div class="col-md-4">
                <label class="radio-inline"><input type="radio" name="gender">Frau</label>
                <label class="radio-inline"><input type="radio" name="gender">Mann</label>
                <label class="radio-inline"><input type="radio" name="gender">Anderes</label>
            </div>
    </div>
    <div class="row">
        <div class="col-md-2">
                <label for="usr">Vorname:</label>
                <input type="text" class="form-control" id="vorname" name="vorname">
        </div>
        <div class="col-md-2">
                <label for="usr">Name:</label>
                <input type="text" class="form-control" id="name" name="name">
        </div>
    </div>
    <div class="row">
        <div class="col-md-3">
                <label for="usr">Strasse:</label>
                <input type="text" class="form-control" id="strasse" name="strasse">
        </div>
    </div>
    <div class="row">
        <div class="col-md-1">
                <label for="usr">PLZ:</label>
                <input type="text" class="form-control" id="plz" name="plz">
        </div>
        <div class="col-md-2">
                <label for="usr">Ort:</label>
                <input type="text" class="form-control" id="ort" name="ort">
        </div>
    </div>
    <div class="form-group" class="form-horizontal">
        <label class="control-label col-sm-2"  for="usr">Email:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control" id="email" name="email">
            </div>
    </div>
    <div class="form-group" class="form-horizontal">
        <label class="control-label col-sm-2" for="pwd">Password:</label>
        <div class="col-sm-3">
            <input type="password" class="form-control" id="pwd" placeholder="Enter password">
        </div>
    </div>
    </div>
    <div class="form-group">
        <div class="col-sm-3">
            <button type="submit" class="btn btn-primary">Submit</button>
        </div>
    </div>
    <br>
  </form>
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

你正在谈论这样吗?查看下面的代码段。

&#13;
&#13;
from ctypes import *
from ctypes.wintypes import *

LPWSTR = POINTER(WCHAR)
HINTERNET = LPVOID

INTERNET_PER_CONN_PROXY_SERVER = 2
INTERNET_OPTION_REFRESH = 37
INTERNET_OPTION_SETTINGS_CHANGED = 39
INTERNET_OPTION_PER_CONNECTION_OPTION = 75
INTERNET_PER_CONN_PROXY_BYPASS = 3
INTERNET_PER_CONN_FLAGS = 1

class INTERNET_PER_CONN_OPTION(Structure):
    class Value(Union):
        _fields_ = [
            ('dwValue', DWORD),
            ('pszValue', LPWSTR),
            ('ftValue', FILETIME),
        ]

    _fields_ = [
        ('dwOption', DWORD),
        ('Value', Value),
    ]

class INTERNET_PER_CONN_OPTION_LIST(Structure):
    _fields_ = [
        ('dwSize', DWORD),
        ('pszConnection', LPWSTR),
        ('dwOptionCount', DWORD),
        ('dwOptionError', DWORD),
        ('pOptions', POINTER(INTERNET_PER_CONN_OPTION)),
    ]

def set_proxy_settings(ip, port, on=True):
    if on:
        setting = create_unicode_buffer(ip+":"+str(port))
    else:
        setting = None

    InternetSetOption = windll.wininet.InternetSetOptionW
    InternetSetOption.argtypes = [HINTERNET, DWORD, LPVOID, DWORD]
    InternetSetOption.restype  = BOOL

    List = INTERNET_PER_CONN_OPTION_LIST()
    Option = (INTERNET_PER_CONN_OPTION * 3)()
    nSize = c_ulong(sizeof(INTERNET_PER_CONN_OPTION_LIST))

    Option[0].dwOption = INTERNET_PER_CONN_FLAGS
    Option[0].Value.dwValue = (2 if on else 1) # PROXY_TYPE_DIRECT Or 
    Option[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER
    Option[1].Value.pszValue = setting
    Option[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS
    Option[2].Value.pszValue = create_unicode_buffer("localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;172.32.*;192.168.*")

    List.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LIST)
    List.pszConnection = None
    List.dwOptionCount = 3
    List.dwOptionError = 0
    List.pOptions = Option

    InternetSetOption(None, INTERNET_OPTION_PER_CONNECTION_OPTION, byref(List), nSize)
    InternetSetOption(None, INTERNET_OPTION_SETTINGS_CHANGED, None, 0)
    InternetSetOption(None, INTERNET_OPTION_REFRESH, None, 0)

set_proxy_settings("127.0.0.1", 52042)
&#13;
&#13;
&#13;