简体   繁体   English

难以在网站上集中元素

[英]Having trouble centering elements on website

I was working on a personal website for someone, and I came across an issue centering his portfolio section on his page. 我正在为某人的个人网站工作,我遇到了一个问题,将他的投资组合部分集中在他的页面上。 The concerned page can be viewed at http://websitetesting.pro/portfolio.html , my website for testing purposes. 有关页面可以在我的网站http://websitetesting.pro/portfolio.html查看,以便进行测试。 The portfolio images are under the "figure" tag, but the problem should be under the class "rowone", as that's the parent element to the figure images. 投资组合图像位于“数字”标签下,但问题应该在“rowone”类下,因为它是图形图像的父元素。 Here's the code for row one. 这是第一行的代码。

.rowone {
    height:240px;
    margin-left: 25%;
    margin-right: 25%;
    line-height: 240px;
    text-align: center;
    margin: auto;
}

If not in there, the error should be somewhere in either the "main" css, or the "portfolio" css which refers directly to the portfolio page. 如果不在那里,则错误应该在“主”css中,或者“投资组合”css中直接引用投资组合页面。

The .column class is a block element which it fills the whole page by width. .column类是一个块元素,它按宽度填充整个页面。 When set to inline block it retains a certain width and it can be moved around. 设置为内联块时,它保持一定的宽度,可以移动。

.column {
    display: inline-block;
}

or 要么

hover01 {
 display: inline-block;
    }

options 2 is better. 选项2更好。 SO you wouldn't target a general class 所以你不会针对一般班级

.rowone {
    height: 240px;
    line-height: 240px;
    text-align: center;
    display: table;
    margin: 0 auto;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM