2016-07-30 23 views
-1

我刚完成编码主题和所有内容,只要编码和总体外观很好,除了一件事情。所以,当我转到收件箱页面或任何页面的内容比整个侧边栏高度更短时,我的侧边栏div似乎超出了我的容器div。这里有一个例子 image。 这里是编码结构的CSS & HTML。边栏显示在tumblr主题的div外部

.sidebar { 
    width:310px; 
    margin-top:30px; 
    margin-left: 590px; 
    position: absolute; 

.wrap { 
    width: 920px; 
    margin: 0 auto; 
    background:{color:content background}; 
    padding: 20px 20px 0px 20px; 
    margin-top: -5px; 
    position: relative; 

} 

.content { 
    margin-top:30px; 
    width: 500px; 
    margin-left:20px; 

} 

<div class="wrap"> <!--CONTAINER--> 

<div class="topbar"> <!--TOP LINKS--> 
<div id="title">{title}</div> 
<div class="links"> 
    <a href="/">Home</a> 
    <a href="/ask">Inbox</a> 
    <a href="/archive">Archive</a> 
    <a href="{text:link 1 url}">{text:link 1 title}</a> 
    <a href="{text:link 2 url}">{text:link 2 title}</a> 

    <!--DO NOT REMOVE CREDIT!!!--> 
    <a href="http://ixaathemes.tumblr.com/">Theme</a> 
    <!--DO NOT REMOVE CREDIT!!!--> 

</div> <!--TOP LINKS--> 


</div> 

<div class="header"> 
<img src="{image:header}"> 
</div> 

<div class="sidebar"> <!--SIDEBAR CONTENT. THIS IS WHERE THE SIDEBOXES ARE WHERE YOU CAN MANUALLY ADD THE CONTENTS--> 



    <!-- DESCRIPTION BOX --> 

<div class="cat"> 
    <div class="cti"><i class="fa fa-user" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>Welcome</div> 
<div class="sideimg"><img src="{image:sidebar}"></div> 
    <div class="description">{Description}</div> 
</div> 

    <!-- NAVIGATION LINKS --> 
{block:ifextralinks} 
<div class="cat"> 
    <div class="cti"><i class="fa fa-list" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>Navigation Links</div> 
<div class="morelinks"> 
    {block:ifCustomLink1}<a href="{text:CustomLink1URL}">{text:CustomLink1Name}</a>{/block:ifCustomLink1} 
    {block:ifCustomLink2}<a href="{text:CustomLink2URL}">{text:CustomLink2Name}</a>{/block:ifCustomLink2} 
    {block:ifCustomLink3}<a href="{text:CustomLink3URL}">{text:CustomLink3Name}</a>{/block:ifCustomLink3} 
    {block:ifCustomLink4}<a href="{text:CustomLink4URL}">{text:CustomLink4Name}</a>{/block:ifCustomLink4} 
    {block:ifCustomLink5}<a href="{text:CustomLink5URL}">{text:CustomLink5Name}</a>{/block:ifCustomLink5} 
    {block:ifCustomLink6}<a href="{text:CustomLink6URL}">{text:CustomLink6Name}</a>{/block:ifCustomLink6} 
</div> 
</div> 
{/block:ifextralinks} 

    <!-- UPCOMING EVENTS --> 
{block:ifevents} 
<div class="cat"> 
    <div class="cti"><i class="fa fa-calendar" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>Upcoming events</div> 

    <div class="events"> 

<!-- THIS IS WHERE YOU WILL ADD YOUR UPCOMING EVENTS IF YOU PLEASE. if you would like to add more just copy the code below: 

<tr> 
<td> 
<div class="date">Event date here</div> 
</td> 
<td> 
<div class="e">Event info here</div> 
</td> 
</tr> 

make sure to past it right about the 'event end' 
--> 

<table style="width:100%"> 

<!-- events box start --> 

<tr> 
<td> 
<div class="date">November 12</div> 
</td> 
<td> 
<div class="e">Event: One</div> 
</td> 
</tr> 

<tr> 
<td> 
<div class="date">November 13</div> 
</td> 
<td> 
<div class="e">Event: two</div> 
</td> 
</tr> 

<tr> 
<td> 
<div class="date">November 14</div> 
</td> 
<td> 
<div class="e">Event: three</div> 
</td> 
</tr> 

<tr> 
<td> 
<div class="date">November 14</div> 
</td> 
<td> 
<div class="e">Event: four</div> 
</td> 
</tr> 

<!-- events box start --> 
</table> 
</div></div> 
{/block:ifevents} 

    <!-- PROJECTS --> 
{block:ifprojects} 
<div class="cat"> 
    <div class="cti"><i class="fa fa-book" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>Projects</div> 

    <div class="projects"> 

    <!-- THIS IS WHERE YOU WILL ADD THE PROJECTS THAT CORRESPOND WITH THE THEME OF YOUR FANSITE BLOG. iF YOU WOULD LIKETO ADD MORE JUST COPY THE CODE BELOW: 

    <tr> 
<td style="width:30px">   
      <img src="IMAGE URL"> 
</td> 
<td> 
       <div class="pinfo"> 
       <b>Title:</b><br> 
       <l1> 
       <b>Info</b>: Info<br> 
       <b>Info</b>: Info<br> 
       <b>Info</b>: Info</div> 
       </l1> 
</td> 
</tr> 

MAKE SURE TO PASTE IT RIGHT ABOVE THE 'PROJECTS END' 
    --> 

<table style="margin-top:0px; width:100%"> 

    <!-- PROJECTS START--> 

<tr> 
<td style="width:30px">   
      <img src="http://static.tumblr.com/pbhn8p5/BPwo9x2yv/ject-5.png"> 
</td> 
<td> 
       <div class="pinfo"> 
       <b>Title:</b><br> 
       <l1> 
       <b>Info</b>: Info<br> 
       <b>Info</b>: Info<br> 
       <b>Info</b>: Info</div> 
       </l1> 
</td> 
</tr>    

<tr> 
<td style="width:30px">     
       <img src="http://static.tumblr.com/pbhn8p5/AoQo9x30n/ject-6.png"> 
</td> 
<td> 
       <div class="pinfo"> 
       <b>Title:</b><br> 
       <l1> 
       <b>Info</b>: Info<br> 
       <b>Info</b>: Info<br> 
       <b>Info</b>: Info</div> 
       </l1> 
</td> 
</tr> 

<tr> 
<td style="width:30px">     
          <img src="http://static.tumblr.com/pbhn8p5/t5so9x315/ject-7.png"> 
</td> 
<td> 
       <div class="pinfo"> 
       <b>Title:</b><br> 
       <l1> 
       <b>Info</b>: Info<br> 
       <b>Info</b>: Info<br> 
       <b>Info</b>: Info</div> 
       </l1> 
</td> 
</tr> 

    <!-- PROGECTS END--> 
</table>    

       </div></div> 
{/block:ifprojects} 

    <!-- MEMBERS --> 
{block:ifmembers} 
<div class="cat"> 
    <div class="cti"><i class="fa fa-users" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>Members</div> 

    <!-- THIS IS BASICALLY SET UP FOR A GROUP BLOG SCENARIO. BASICALLY THE BLOGGER (YOU) GIVE PERMISSION FOR OTHER PEOPLE TO HAVE ACCESS TO THIS BLOG. FOR MORE INFORMATION ON HOW TO SET THIS UP CHECK OUT THIS WEBSITE BELOW 

    http://smallbusiness.chron.com/set-up-admins-tumblr-34947.html 

    SO TO PUT IT SIMPLY YOU DON'T EDIT THIS BOX LIKE YOU WOULD THE OTHERS UNLESS YOU KNOW WHAT YOU'RE DOING. 
    --> 


    {block:GroupMembers} 
<table style="margin-top:0px; padding: 10px;"> 
{block:GroupMember} 
<tr> 
<td style="width:40px;"> 
<img src="{GroupMemberPortraitURL-40}" width="40px;" height="40px;" style="margin-right: 10px; padding:5px;"> 
</td> 
<td style="width:290px; height:auto;"> 
<div id="m" style="margin-bottom:10px;"> 
<a href="{GroupMemberURL}" style="color:{color:desc link};">{GroupMemberName}</a><br>{GroupMemberTitle}</div> 

</tr> 
{/block:GroupMember} 
</table> 
{/block:GroupMembers} 
</div> 
{/block:ifmembers} 

    <!-- UPDATES BOX --> 
{block:ifupdates} 
<div class="cat"> 
    <div class="cti"><i class="fa fa-pencil" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>Updates</div> 

    <div class="up"> 

<!-- THIS IS THE UPDATES TAP WHERE YOU CAN PLACE ALL OF YOUR RECORDS OF YOUR RECENT BLOG-RELATED UPDATES. IF YOU WOULD LIKE TO ADD MORE UPDATES THEN YOU CAN JUST COPY THE CODE BELOW: 

<tr> 
<td><div class="update">date</div></td> 
<td><div class="upinfo">update</div></td> 
</tr> 

MAKE SURE TO PASTE THE CODE RIGHT ABOUT THE 'UPDATES END' 

--> 

<table style="width:100%"> 

    <!-- UPDATES START --> 

<tr> 
<td><div class="update">11.12:</div></td> 
<td><div class="upinfo">update one</div></td> 
</tr> 

<tr> 
<td><div class="update">11.13:</div></td> 
<td><div class="upinfo">update one</div></td> 
</tr> 

<tr> 
<td><div class="update">11.14:</div></td> 
<td><div class="upinfo">update one</div></td> 
</tr> 

<tr> 
<td><div class="update">11.15:</div></td> 
<td><div class="upinfo">update one</div></td> 
</tr> 

    <!-- UPDATES END --> 
</table> 
</div>   
</div> 
{/block:ifupdates} 

    <!-- AFFILIATES --> 
{block:ifaffiliates} 
<div class="cat"> 
    <div class="cti"><i class="fa fa-laptop" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>Affiliates</div> 

    <div class="affiliates"> 

<!-- THIS IS WHERE YOU CAN ADD THE IMAGES OF THE SISTER BLOG IN WHICH YOUR FANSITE IS AFFILIATED WITH. IF YOU WOULD LIKE TO ADD MORE PICTURES THEN JUST CODY THE CODE BELOW 

     <a href="/" title="visit blog"><img src="IMAGE URL"/></a> 

MAKE SURE TO PASTE THE CODE RIGHT ABOVE THE 'AFFILIATES END' 
--> 

<!-- AFFILIATES START--> 

     <a href="/" title="apply"><img src="http://static.tumblr.com/7r3q3uq/MmIo6iq7n/ject-1.png"/></a> 
     <a href="/" title="apply"><img src="http://static.tumblr.com/7r3q3uq/lado6ipym/ject-2.png"/></a> 
     <a href="/" title="apply"><img src="http://static.tumblr.com/7r3q3uq/QrJo6ipyy/ject-3.png"/></a> 
     <a href="/" title="apply"><img src="http://static.tumblr.com/7r3q3uq/L0Mo6ipz9/ject-4.png"/></a> 

<!-- AFFILIATES END-->  
    </div> 
</div> 
{/block:ifaffiliates} 

    <!-- OFFICIAL LINKS --> 
{block:ifofficiallinks}  
<div class="cat"> 
    <div class="cti"><i class="fa fa-globe" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>Official Links</div> 
    <div class="off"> 

<!-- THEM OFFICIAL LINKS WHICH ARE ALREADY SET UP FOR YOU IN THE EDIT THEME SECTION DO NOT CHANGE ANYTHING BELOW. --> 

     <a href="{text:official link 1 url}">{text:official link 1 title} <i class="fa fa-twitter" style="float:right; color:{color:navi};"></i></a> 
     <a href="{text:official link 2 url}">{text:official link 2 title} <i class="fa fa-instagram" style="float:right; color:{color:navi};"></i></a> 
     <a href="{text:official link 3 url}">{text:official link 3 title} <i class="fa fa-facebook" style="float:right; color:{color:navi};"></i></a> 
     <a href="{text:official link 4 url}">{text:official link 4 title} <i class="fa fa-snapchat-ghost" aria-hidden="true" style="float:right; color:{color:navi};"></i></a> 
     <a href="{text:official link 5 url}">{text:official link 5 title} <i class="fa fa-youtube-play" style="float:right; color:{color:navi};"></i></a> 
    </div> 
</div> 
{/block:ifofficiallinks}  

<!-- BLOG INFO --> 
{block:ifbloginfo} 
<div class="cat"> 
    <div class="cti"><i class="fa fa-check" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>About this blog</div> 
    <div class="binfo"> 

<!-- GENER BLOG INFO LIKE WHEN WAS IT ESTABLISHED. YOUR FREE HOSTED SCRIPTS (ONLINE USERS, BLOG VISITS, FOLLOWERS/ETC. --> 

    <b>About:</b> A fansite theme for fandom challenges, character, shipss, whatever floats your boat <br> 
     <b>Admins:</b> 1 <br> 
     <b>Designed by:</b> <a href="http://ixathemes.tumblr.com">ixathemes</a> @ tumblr<br> 
     <b>Online:</b> <script language="JavaScript"> 
var ref = (''+document.referrer+''); 
var w_h = window.screen.width + " x " + window.screen.height; 
document.write('<script src="http://s1.freehostedscripts.net/ocounter.php?site=ID4973001&e1=ghoul &e2=ghouls &r=' + ref + '&wh=' + w_h + '"><\/script>'); 
</script> <br> 
     <b>Visits:</b> <script language="JavaScript" src="http://s1.freehostedscripts.net/ocount.php?site=ID2955028&name=investigators"></script><br><br> 

      This site claims no credit for any images posted unless it's been stated otherwise. Images and information posted on this blog are copyrighted to their respective owners. 
     </div> 
</div> 
{/block:ifbloginfo} 

    <!-- Search Bar --> 
{block:ifsearch} 
<div class="cat"> 
    <div class="cti"><i class="fa fa-search" aria-hidden="true" style="padding-right:10px; color:{color:titles};"></i>search</div> 

    <div class="bsearch"> 

<!-- THIS IS SEARCHBAR CODE. DO NOT TOUCH PLEASE. --> 

<script language="javascript"> 
function send() 
{document.theform.submit()} 
</script>    
<form action="/search" method="get" class="sfm"> 
    <input type="text" name="q" value="search" id="sf"/> 
    <input type="image" value="Search" src="http://static.tumblr.com/f1skqpy/Oxbn13qun/search_icon.png" id="sb"/> 
</form> 

<!-- THIS IS SEARCHBAR CODE. DO NOT TOUCH PLEASE. --> 
    </div> 
</div> 
{/block:ifsearch} 
<!-- Search Bar --> 

</div> <!--SIDEBAR--> 

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

{block:ContentSource} 
<!-- {SourceURL}{block:SourceLogo}<img src="{BlackLogoURL}" 
width="{LogoWidth}" height="{LogoHeight}" alt="{SourceTitle}" /> 
{/block:SourceLogo} 
{block:NoSourceLogo}{SourceLink}{/block:NoSourceLogo} --> 
{/block:ContentSource} 

<!-- {block:NoRebloggedFrom} 
{block:RebloggedFrom}{ReblogParentName}{/block:RebloggedFrom} 
{/block:NoRebloggedFrom} --> 

{block:Text} 
{block:Title}<div class="title">{Title}</div>{/block:Title} 
<div class="text">{Body}</div> 
{/block:Text} 


{block:Photo} 
{LinkOpenTag}<img src="{PhotoURL-500}" width="500">{LinkCloseTag} 
{/block:Photo} 


{block:Photoset} 
{Photoset-500} 
{/block:Photoset} 

{block:Quote} 
<center> 
<div class="quote-box">"</div> 
</center> 
<div class="qtline"></div> 
<div class="quote">{Quote}</div> 
{block:Source}<div class="qtsource"><br><center>- {Source} -</center></div>{/block:Source} 
{/block:Quote} 

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


{block:Chat} 
{block:Title}<h1>{Title}</h1>{/block:Title} <div class="chat"> {block:Lines} <li class="line {Alt}"> {block:Label} <span class="label"> {Label}</span> {/block:Label}{Line}</li> {/block:Lines}</div> 
{/block:Chat} 


{block:Audio} 
<div class="playbox"><div class="playbutton">{block:AudioPlayer}{AudioPlayerWhite}{/block:AudioPlayer}</div></div> 

{block:AlbumArt} 
<img src="{AlbumArtURL}" class="cover"> 
{/block:AlbumArt} 

<div class="trackdetails"><br> 
{block:TrackName}<b>Track:</b> {TrackName}{/block:TrackName}<br> 
{block:Artist}<b>Artist:</b> {Artist}{/block:Artist}<br> 
{block:Album}<b>Album:</b> {Album}{/block:Album}<br> 
{block:PlayCount}<b>Played:</b> {PlayCountWithLabel}{/block:PlayCount} 
</div> 
{/block:Audio} 


{block:Video} 
{Video-500} 
{/block:Video} 


{block:Answer} 
<div id="asker"><b>{Asker} asked:</b></div> 
<img src="{AskerPortraitURL-64}"align="left" style="border:5px solid {color:asker portrait border}"> 
<div class="question"> 
{Question}&nbsp;</div> 
<div class="answer">{Answer}</div> 
{/block:Answer} 

{block:IfShowCaptions}{block:Caption}<div class="text">{Caption}</div>{/block:Caption}{/block:IfShowCaptions} 
{block:IfnotShowCaptions} 
{block:PermalinkPage}{block:Caption}<div class="text">{Caption}</div>{/block:Caption}{/block:PermalinkPage}{/block:IfnotShowCaptions} 

{block:IndexPage} 
<div class="info"> <!--Permalink and Notes--> 
Posted 
{block:Date} 
<a href="{Permalink}" title="{TimeAgo}">{Month} {DayOfMonth}{DayOfMonthSuffix}</a> 
{/block:Date} 
{block:NoteCount} with <a href="{Permalink}" title="go to permalink page">{NoteCountWithLabel}</a>{/block:NoteCount} 

<font style="float:right"> 
{block:RebloggedFrom} 
<a href="{ReblogParentURL}" title="{ReblogParentName}">via </a> 
{block:ContentSource} 
<a href="{ReblogRootURL}" "{ReblogRootName}" title="{ReblogRootName}">| src</a> 
{/block:ContentSource} 
| 
{/block:RebloggedFrom} 
<a href="{ReblogURL}" title="Reblog this post"> reblog</a> 
</font style> 
</div> <!--Permalink and Notes--> 

<!--TAGS--> 
{block:ifShowTags} 
{block:HasTags}<div id="tag">{block:Tags}<a href="{TagURL}" title="Tagged as">#{tag}</a> {/block:Tags}</div>{/block:HasTags}{/block:ifShowTags} 
{block:permalinkpage}{block:ifnotShowTags}{block:HasTags}<div id="tag"> {block:Tags}<a href="{TagURL}" title="Tagged as">#{Tag}</a>{/block:Tags}</div>{/block:HasTags}{/block:ifnotShowTags}{/block:permalinkpage} 
<!--TAGS--> 

{/block:IndexPage} 
</div> <!--CONTENT--> 

{block:PermalinkPage} <!--PERMALINK PAGE--> 
<div id="perma"> 
{block:Date}Posted {ShortMonth} {DayOfMonthWithZero}, {Year} @ {12Hour} {AmPm}{/block:Date} 
{block:NoteCount}with {NoteCountWithLabel}{/block:NoteCount}{block:RebloggedFrom} 
<br> 
<a href="{ReblogParentURL}">via: {ReblogParentName}</a> + 
<a href="{ReblogRootURL}">source: {ReblogRootName}</a> 
{/block:RebloggedFrom} 
<br> 
{block:HasTags}{block:Tags}<a href="{TagURL}" title="Tagged as">#{Tag}</a> {/block:Tags}{/block:HasTags} 
</div> 

{block:PostNotes} 
{PostNotes} 
{/block:PostNotes} 
{/block:PermalinkPage} 
{/block:Posts} <!--PERMALINK PAGE--> 

<div id="foot"> <!--PAGINATION BAR--> 
<!--pagination--> 
    {block:IfNotInfiniteScroll} 
    {block:Pagination} 
      <div id="pagination"> 
       {block:PreviousPage}<a href="{PreviousPage}">«</a>{/block:PreviousPage} 
       {block:JumpPagination length="5"} 
       {block:CurrentPage}<span class="current_page">X</span>{/block:CurrentPage} 
       {block:JumpPage}<a href="{URL}">{PageNumber}</a> {/block:JumpPage} 
       {/block:JumpPagination} 
       {block:NextPage}<a href="{NextPage}">»</a>{/block:NextPage} 
      </div> 
     {/block:Pagination} 
{/block:IfNotInfiniteScroll} 
<!--pagination--> 
</div> <!--PAGINATION BAR--> 
</div> <!--CONTAINER--> 

所以我想知道有没有办法对我来说,解决这个问题,因为我是一个主题壶和我的人来到我的收件箱关于这个问题,我讨厌说我没有回应的想法,这可能导致他们放弃主题,因为我不知道如何解决设计缺陷。非常感谢:)

以下是密码pastebin code

回答

0

浏览器计算所述容器的高度应该是什么时,不会考虑到绝对定位的侧栏。因此,当没有主要内容或主要内容的高度不足侧栏时,容器太短。

为了克服这一点,你可以设置一个最小高度为您的容器元素等于与jQuery的侧边栏的高度,比如:

$(document).ready(function(){ 
$(".wrap").css("min-height", function(){ 
return $(".sidebar").innerHeight()+30; 
});}); 

如果你的侧边栏包含了我会建议使用imagesLoaded结合图片这样脚本就会占用图像的高度,而不是在加载时将它们设置为0。 我们在侧边栏的计算高度上添加30来计算上边距。

+0

非常感谢你,过了一段时间我真的找到了解决这个问题的方法,所以我想感谢所有帮助过我的人。我非常感谢时间和精力:) – shuntuationatseirin

0

设置体和HTML的高度和宽度为100%

+0

非常感谢你的建议。我试过了,不幸的是它没有工作。 – shuntuationatseirin