我正在为我的网站使用语义UI框架。我想将登录框放在页面的中心。我只想要页面中的登录框。我不明白如何使用Semantic UI'网格类对中心对齐。请帮我知道如何安装登录框。
我的代码:
<!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>
答案 0 :(得分:29)
请参阅此link中的代码:
<div class="ui one column stackable center aligned page grid">
<div class="column twelve wide">
Your stuff here
</div>
</div>
答案 1 :(得分:3)
<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>
答案 2 :(得分:1)
<div class="ui segment" style="margin: 0 auto;">
<h4 class="ui dividing header">Account Info</h4>
<div class="ui form">
........
</div>
</div>
&#13;
答案 3 :(得分:0)
这是我的实现,效果很好。
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
#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;
}