Html 语义UI中心对齐的登录框?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27343992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:09:44  来源:igfitidea点击:

Semantic UI centre aligned login box?

htmlcsssemantic-ui

提问by reegan29

I am using the Semantic UI framework for my website. I want to place the login box in the centre of the page.I want only the login box in the page. I don't understand how to centre aligned using Semantic UI 'grid classes'. Please help me how to fit the login box.

我正在为我的网站使用语义 UI 框架。我想把登录框放在页面的中央。我只想要页面中的登录框。我不明白如何使用语义 UI '网格类' 居中对齐。请帮助我如何适应登录框。

My Code:

我的代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>my semantic website</title>
<link rel="stylesheet" href="../css/semantic.min.css">
<link rel="stylesheet" href="../css/style.css">
<script src="../js/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8" async defer>     </script>
<script src="../js/semantic.min.js" type="text/javascript" charset="utf-8" async defer></script>
</head>
<body>
<div class="ui grid">
    <div class="one column row">
        <div class="ui padded grid">
            <div class="three column row">
                <div class="column">
                    <div class="ui segment">
                        <h4 class="ui dividing header">Account Info</h4>
                        <div class="ui form">
                            <div class="field">
                                <label for="username">Username: </label>
                                <div class="ui icon input">
                                    <input type="text" placeholder="Username" name="username" id="username">
                                    <i class="user icon"></i>
                                </div>
                            </div>
                            <div class="field">
                                <label for="password">Password: </label>
                                <div class="ui icon input">
                                    <input type="password" placeholder="Password" name="password" id="password">
                                    <i class="lock icon"></i>
                                </div>
                            </div>
                            <input type="submit" name="submit" class="ui inverted blue button">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>

回答by Lucio Rubens

See this code found in this link:

请参阅此链接中的此代码:

<div class="ui one column stackable center aligned page grid">
   <div class="column twelve wide">
       Your stuff here
   </div>
</div>

回答by cosbor11

<div class="ui column stackable center page grid">
  <div class="four wide column"></div><!-- empty div just padding -->
  <form class="ui six wide column form segment">
     <!-- login input fields go here -->
  </form>
</div>

回答by Andrea Fini

This is my implementation, it works well.

这是我的实现,效果很好。

JsFiddle link

JsFiddle 链接

HTML

HTML

<div id="v-container" class="ui grid middle aligned">
  <div class="row">
    <div class="column" align="middle">


      <div class="ui raised card ">
        <div class="ui small centered image no-background ">
          <img class="image-margin image-border" src="https://semantic-ui.com/images/wireframe/image.png">
        </div>
        <div class="content">
          <div class="ui header">TITLE</div>
          <div class="meta">
            SUBTITLE
          </div>
          <div class="description">
            <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Ab, alias.</p>
          </div>
        </div>
        <div class="extra content">
          extra content
        </div>
      </div>


    </div>
  </div>

CSS

CSS

#v-container {
  background: #ddd;
  height: 100vh;
  width: 100%;
}

.image-margin {
  margin-top: 16px;
  margin-bottom: 16px;
}

.image-border {
  border-radius: 4px !important;
}

.no-background {
  background: transparent !important;
}

回答by Maxim Kovalevsky

<div class="ui segment" style="margin: 0 auto;">
     <h4 class="ui dividing header">Account Info</h4>
     <div class="ui form">
         ........
     </div>
</div>