定位 tumblr 帖子(默认居中)?

positioning tumblr posts (centered by default)?

所以这是我的 tumblr 页面,我无法将帖子从页面中心移动到页面右侧...给我推一下什么的。

screenshot showing it

首先,我会使用 "inspector" 工具找到您想要设置样式的容器。在您浏览器的检查器工具中,我建议您试一试事物的外观,以评估您希望网站的外观。

当你说你希望你的帖子在右边而不是中间时,你可以通过以下方式实现:

选择帖子的父容器 (<article>),您可以应用以下样式:

#content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

这会将整个 div#content 移到右边。然后您可以根据需要使用边距和填充来定位它。

如果您想在 div#content 中移动 dividual 帖子 (<article>),您可以从 div# 中删除 align-items: flex-end;内容,然后使用 article:nth-child() 选择器来定位特定的帖子。如果你想把它们移到右边,你可以这样给它们添加 align-self:

#content article:nth-child(2) {
  align-self: flex-end;
}

您也可以使用 float,但请记住,这会将元素从 DOM 的正常流程中移除,如果您没有使用此类样式元素的经验,可能会影响您网站的外观.这与使用 position.

相同