【问题标题】:tumblr text posts overlappingtumblr 文本帖子重叠
【发布时间】:2021-10-22 16:32:26
【问题描述】:

我是创建主题的新手,我创建了一个side blog 用于练习。我不知道为什么,但文本帖子似乎相互重叠,然后与其他帖子以及右下角的分页发生冲突。我不确定如何解决此问题,也不确定是什么原因造成的。

这是 tumble 博客主题的 CSS。

<style type="text/css">

/***SIDEBAR***/
#sidebar {
    position: fixed;
    height: 100%;
    width: 270px;
    left: 0px;
    top: 0px;
    background-color: #fff;
}

#description {
    font-size: 12px;
    color: #3a3a3a;
    text-align: justify;
    padding-left: 5%;
    padding-right: 5%;
}


/***GENERIC***/
body {
    background-color: #f2f2f2;
    font-family: 'Yeon Sung';
    font-size: 14px;
    color: #3a3a3a;
}

a {
    text-decoration: none;
    color: #9f815d;
    
    -webkit-transition: all 0.7s ease;
    -moz-transition: all 0.7s ease;
    -o-transition: all 0.7s ease;
}
a:hover {
    color: #c0c0c0;
}

b, strong {
    color: #9f665d;
}

i, em {
    color: #9a9f5d;
}

blockquote {
    padding: 2px 7px;
    margin: 3px 0 3px 8px;
    border-left: 1px dotted #c0c0c0;
}
blockquote img {
    max-width: 100%;
    height: auto;
}

img {
    max-width: 100%;
}

h1 {
    font-family: 'UnifrakturMaguntia';
    font-size: 30px;
    line-height: 30px;
    text-align: right;
    padding-left: 5%;
    padding-right: 5%;
}

#links {
    font-size: 13px;
    padding-left: 5%;
    padding-right: 5%;
    padding-top: 5%;
}
#links a {
    display: inline-block;
    color: #3a3a3a;
    padding: 2%;
    
   -webkit-transition: all 0.7s ease;
   -moz-transition: all 0.7s ease;
   -o-transition: all 0.7s ease;
}
#links a:hover {
    color: #c0c0c0;
}


/***POSTS***/
.container {
    padding:10px;
    width:500px;
    margin-left:0px;
    margin-top:20px;
    margin-bottom:60px;
}

.posts {
    width: 500px;
    background-color: #fff;
    margin-top:60px;
    margin-left: 400px;
    padding: 10px;
    margin-bottom: 30px;
}

/***PERMALINKS & TAGS***/
.permalinks {
    text-align: center;
}
.permalinks a {
    text-decoration: none;
    font-size: 12px;
    color: #3a3a3a;
}
.permalinks a:hover {
    color: #5d9e9f;
}

.tags {
    text-align: center;
}
.tags a {
    text-decoration: none;
    text-transform: uppercase;
    font-size: 10px;
    color: #3a3a3a;
}
.tags a:hover {
    color: #715d9f;
}

/***PAGINATION***/
#pagination {
    position: fixed;
    bottom: 30px;
    right: 100px;
}
#pagination a {
    color: #3a3a3a;
    font-size: 18px;
    
    -webkit-transition: all 0.7s ease;
    -moz-transition: all 0.7s ease;
    -o-transition: all 0.7s ease;
}
#pagination a:hover {
    color: #c0c0c0;
}

和 HTML:

<body>
<div class="container">

<!---SIDEBAR--->
<div id="sidebar">
<h1>{Title}</h1>

<div id="description">{block:Description}{Description}{/block:Description}</div>

<div id="links">
    <a href="/">home</a>
    <a href="/ask">ask</a>
    <a href="/archive">archive</a>
    <a href="">link</a>
    <a href="">link</a>
    <a href="">link</a></div></div>

<!---POSTS--->   
{block:Posts}<div class="posts">

{block:Text}{block:Title}{Title}{/block:Title}{Body}{/block:Text}

{block:Photo}<img src="{PhotoURL-500}" alt="{PhotoAlt}"/>{block:Caption}{Caption}{/block:Caption}{/block:Photo}

{block:Panorama}{LinkOpenTag}<img src="{PhotoURL-Panorama}" alt="{PhotoAlt}"/>{LinkCloseTag}{block:Caption}{Caption}{/block:Caption}{/block:Panorama}

{block:Photoset}{Photoset}{block:Caption}{Caption}{/block:Caption}{/block:Photoset}

{block:Quote}"{Quote}"{block:Source}{Source}{/block:Source}{/block:Quote}

{block:Link}<a href="{URL}" class="link" {Target}>{Name}</a>{block:Description}{Description}{/block:Description}{/block:Link}

{block:Chat}{block:Title}{Title}</a>{/block:Title}
{block:Lines}<li>{block:Label}{Label}{/block:Label}{Line}</li>{/block:Lines}{/block:Chat}
                        
{block:Video}{Video-500}{block:Caption}{Caption}{/block:Caption}{/block:Video}

{block:Audio}{AudioEmbed}{block:Caption}{Caption}{/block:Caption}{/block:Audio}

<!---PERMALINK & TAGS--->
<div class="permalinks"><a href="{permalink}">{DayOfMonth}{DayOfMonthSuffix} {ShortMonth} {Year} </a><a href="{permalink}">{block:NoteCount}{NoteCount}{/block:NoteCount}</a></div><div class="tags">{block:HasTags}{block:Tags}<a href="{TagURL}"> {Tag}{/block:Tags}</a></div>

</div>{/block:Posts}
    
</div>
    
<!---PAGINATION--->
<div id="pagination">{block:Pagination}
{block:PreviousPage}<a href="{PreviousPage}">prev</a>{/block:PreviousPage}
{block:NextPage}<a href="{NextPage}">next</a>{/block:NextPage}
{/block:Pagination}</div> 
    
{block:ContentSource}
<!-- {SourceURL}{block:SourceLogo}<img src="{BlackLogoURL}"
width="{LogoWidth}" height="{LogoHeight}" alt="{SourceTitle}" />
{/block:SourceLogo}
{block:NoSourceLogo}{SourceLink}{/block:NoSourceLogo} -->
{/block:ContentSource}
</body>
</html>

【问题讨论】:

  • 看起来您在某处可能没有正确关闭标签。您的帖子应该在循环中输出。但是在您的页面上有几个分页块具有唯一的 id(id 应该只在页面上存在一次)。上面示例中的代码是否与您博客中的代码相同?
  • @lharby,谢谢,我会检查是否遗漏了任何结束标签或错误放置它们。另外,是的,这段代码与我博客上的代码相同。

标签: html css tumblr


【解决方案1】:

好的,我想我已经找到了您的问题。

在一些 tumblr 模板块内有几个异常,我认为您必须将 {block:Posts} 移动到包装器内,尽管我没有对此进行测试。

首先有一个没有开始标签的结束标签&lt;/a&gt;。

此外,这可能不是一个交易敲门砖,但双引号可能无法正确呈现。见附图。

{block:Quote}"{Quote}"{block:Source}{Source}{/block:Source}{/block:Quote}
{block:Link}<a href="{URL}" class="link" {Target}>{Name}</a>{block:Description}{Description}{/block:Description}{/block:Link}
{block:Chat}{block:Title}{Title}</a>{/block:Title}{block:Lines}<li>{block:Label}{Label}{/block:Label}{Line}</li>{/block:Lines}{/block:Chat}

我相信该块应该在包装器内呈现,而不是

{block:Posts}
<div class="posts">
    ...
</div>
{/block:Posts}

应该是

<div class="posts">
{block:Posts}
    ...
{/block:Posts}
</div>

希望这会起作用,但请查看 Tumblr 文档以获取块示例。

【讨论】:

    【解决方案2】:

    我遇到了这个问题,只是用这个 tut 解决了这个问题:https://viwan-th.tumblr.com/post/46016724933

    CSS:

    #wrap {width:520px; margin:auto;}
    

    HTML:

    <div id="wrap">
    {block:Posts}
    ...post stuff...
    {/block:Posts}
    </div>
    

    【讨论】:

    • 如果我是你,我根本不会提及教程。只需提供您自己的答案即可。
    • @Dharman 我根本没有想到。我不会只是窃取代码并声称它是我自己的。
    猜你喜欢
    • 2012-09-25
    • 2019-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-09
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    相关资源
    最近更新 更多