我无法将我的内容集中在引导程序导航栏中.我正在使用bootstrap 3.我读了很多帖子,但是使用的CSS或方法不能用于我的代码!我真的很沮丧,所以这就像我的最后一个选择.任何帮助,将不胜感激!
<!DOCTYPE html>
<html>
<head>
<title>Navigation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/style.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="container">
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li><a href="#">Link</a></li> …Run Code Online (Sandbox Code Playgroud) 我正在使用引导程序框架并尝试将图像水平居中而不成功.
我已经尝试了各种技术,例如将12个网格系统分成3个相等的块,例如
<div class="container">
<div class="row">
<div class="span4"></div>
<div class="span4"><img src="logo.png" /></div>
<div class="span4"></div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
使图像相对于页面居中的最简单方法是什么?
我有一个只存在表单的页面,我希望将表单放在屏幕的中心.
<div class="container">
<div class="row justify-content-center align-items-center">
<form>
<div class="form-group">
<label for="formGroupExampleInput">Example label</label>
<input type="text" class="form-control" id="formGroupExampleInput" placeholder="Example input">
</div>
<div class="form-group">
<label for="formGroupExampleInput2">Another label</label>
<input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Another input">
</div>
</form>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
该justify-content-center对齐表格水平,但我无法弄清楚如何垂直对齐.我试过使用align-items-center和align-self-center,但它不起作用.
我错过了什么?
我有这个代码的分页
<div class="pagination">
<ul>
<li><a href="?p=0" data-original-title="" title="">1</a></li>
<li><a href="?p=1" data-original-title="" title="">2</a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
但是我ul保持一致.有没有办法让ulwrt 居中div?
我试着margin: auto auto和margin :0 auto他们,但没有奏效.
一个简单的用例场景是使用图像或Bootstrap列中的任何其他内容.通常这些内容需要横向居中.
<div class="container">
<div class="row">
<div class="col-sm-4 col-md-4 col-lg-4 text-center">
<img class="img-responsive" src="img/some-image.png" title="this image needs to be centered">
</div>
<div class="col-sm-8 col-md-8 col-lg-8">
some content not important at this moment
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
在3.1.0版中,添加类文本中心将图像置于列内.但我被迫转到版本3.3.4以解决其他一些问题,这种行为(文本中心)现在已被破坏.我不知道如何将图像或其他内容置于列中.我想避免为包含元素添加类,因为这容易出错或需要另一个包含div.
我目前正从Bootstrap 2切换到Bootstrap 3.如何将Bootstrap 3中的输入字段居中?文本中心正确.它曾经适用于BS2.我试过在div中移动'style ='text-align:center',但仍然没有运气.
<div id="Email_Alert_Modal" class="modal show" tabindex="-1" role="dialog" data-keyboard="false" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="text-align: center">
<h3>Email Alert</h3>
</div>
<div class="modal-body" style="text-align: center">
<h4>Please enter email address that the alert will be sent to.</h4>
<label for="send_email"> </label> <input style="width:200px" type="email" class="form-control" name="email" id="send_email" placeholder="johndoe@yahoo.com" title="Input Email Address">
</div>
<div class="modal-footer">
<button class="btn btn btn-primary" onclick='Email_Alert()' >Send</button>
<button class="btn btn btn" data-dismiss="modal" >Cancel</button>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 在使用Bootstap进行水平中心对齐时,我可以选择一些选项.
我可以使用offset类或使用空白span类作为占位符.另一个选项可以是使用自定义对齐,如下所示
.center {
float: none;
margin: 0 auto;
}
Run Code Online (Sandbox Code Playgroud)
这些选项都没有解决我的问题,因为div容器的内容必须填充100%的宽度.
假设我有以下内容
<div class="container-fluid">
<div class="row-fluid">
<div class="span4 offset4">
<button class="btn">1-1</button>
<button class="btn">1-2</button>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
如果按钮没有填满整个div空间span4,我将无法获得真正的中心对齐.也许,我可以将内容扩展到100%,但我不知道这是否是一个好的做法.
在这里,我有一个可以玩的画布.JS BIN
我试图在 Bootstrap 4 Alpha 6 的旋转木马中水平居中图像。
我尝试过的任何方式似乎都不起作用,包括使用center-block.
这是我到目前为止尝试过的:http : //codepen.io/anon/pen/wJdjQg?editors=1100
任何提示?
我在bootstrap列中有几个图像,如下所示:
<div class="services">
<div class="container">
<div class="row">
<div class="col-md-3 services-section">
<img src="/images/website_design_icon.png"/>
<div class="services-paragraph">
<h3>Website Design</h3>
<p>WordPress themes built for design and functionality</p>
</div>
</div>
<div class="col-md-3 services-section">
<img src="/images/graphic_design_icon.png"/>
<div class="services-paragraph">
<h3>Graphic Design</h3>
<p>Logo designs for identity and print</p>
</div>
</div>
<div class="col-md-3 services-section">
<img src="/images/search_engine_marketing_icon.png"/>
<div class="services-paragraph">
<h3>Search Engine Marketing</h3>
<p>SEO strategies and PPC solutions to increase your presence online</p>
</div>
</div>
<div class="col-md-3 services-section">
<img src="/images/wordpress_conversion_icon.png"/>
<div class="services-paragraph">
<h3>WordPress Conversion</h3>
<p>Take advantage of the number-one CMS in …Run Code Online (Sandbox Code Playgroud)