html - 中心容器

标签 html css

我正在为某人做前端设计,但我无权访问 css 文件或类,所以我看不出是什么导致容器左对齐。

我希望容器在屏幕上居中。什么是最好的方法?我尝试用 text-align: center !important; 包装 div 但没有用。

<div class="portlet-content">
  <div class="portlet-content-container">
    <div class="portlet-body">
      <div>
        <div class="container">
          <div class="biography-view">
            <div class="biography-item col-md-6">
              <div style="border-style:none">
                <div class="biographyimage" style="background-image:url(http://www.math.uni-frankfurt.de/~person/_4170854.jpg);">&nbsp;</div>

                <div class="caption biography-profile">
                  <div class="biography-profile-content">
                    <h3 class="full-name">Name</h3>

                    <p class="person-title">Company Name</p>

                    <p class="person-title"><strong>Person Title</strong></p>

                    <div class="person-biography">Biography</div>

                    <div class="person-biography collapse" id="readmore">More Person Info</div>
                    <a class="read_more" data-target="#readmore" data-toggle="collapse">Read More</a></div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

最佳答案

在容器的 CSS block 中,您可以按如下方式将其居中:

margin-left: auto;
margin-right: auto;

关于html - 中心容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47601027/

相关文章:

html - 悬停时显示隐藏的子菜单

javascript - 一种以编程方式跨元素及其元素 :before? 传输不相关属性的方法

jquery - 自定义带箭头滚动条,仅当文字高于<div/>高度时

android - 随着电话分辨率的提高响应式网页设计

javascript - 是否可以让父元素(相对)填充其绝对定位内容的高度?

javascript - DIV 内容根据 URL 隐藏/显示

javascript - console.log 和 HTML 之间有什么联系?

html - 无序列表元素内容器 div 的垂直对齐

javascript - 通过javascript查找字符串的一部分

python - 使用 beautiful soup 4 抓取 <p class ="postbody"> 标签内的 URL 并将其保存到文本文件中