一个div的高度移动另一个为未知的原因? [英] Height of one div moving another for unknown reason?

查看:78
本文介绍了一个div的高度移动另一个为未知的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎不明白这一点。我在 http://www.codeisdna.com 上设置了我的网络开发投资组合。该网站完成70%。我有一个问题。如果你点击其中一个项目,一个div被展开以显示完整的东西(左边的描述,在Macbook屏幕的形式在右边的预览)。在一些其他选项卡上Macbook移动。当描述框距文本有一定高度时,会发生这种情况。谁能帮助我找到解决方案?我似乎已经尝试了一切。我知道代码有点草率,它很快就会被清除。 html代码:

I can't seem to figure this out. I have my web development portfolio setup at http://www.codeisdna.com. The site is 70% complete. I have a problem though. If you click on one of the projects, a div is expanded to reveal the full thing (a description on the left, a preview on the right in the form of a Macbook screen). On some of the other tabs the Macbook shifts. It happens when the description box has a certain height from the text. Can anyone aid me in finding the solution? I seem to have tried everything. I know the code is somewhat sloppy and it'll be cleaned up soon. The html code:

<div id="project_2" class="project_full psc">
    <div class="wrapper">
        <div class="proj_title">
            <h3>
                Striking Code
                <a class="proj_link" href="#">Visit Site</a>
            </h3>
        </div>
        <div class="proj_details">
            <div class="requirements">
                <p>I felt that it was time to take my old portfolio (and internet identity) and reinvent it into something more clean -- something that more accurately represented my views on development today.</p>
            </div>
            <div class="overview">
                <p>I cleaned up the design (or, well, built a new one), created a new identity, and launched what's now known as code is dna.</p>
            </div>
            <div class="services">
                <ul>
                    <li>UI / UX Design</li>
                    <li>Web Development</li>
                </ul>
            </div>
        </div>
        <div class="proj_preview pull_left">
            <a class="proj_enlarge" id="single_1" href="img.jpg">Click to See More</a>
        </div>
    </div>
</div>

CSS(.proj_preview是Mac,.proj_details是说明):

The CSS (.proj_preview is the Mac, .proj_details is the description):

.project_full {display: none; margin-top: 20px; width: 100%; max-height: 450px; padding: 20px 0px; text-align: center; background: url(../img/code.jpg) top center no-repeat fixed #293134; box-shadow: inset 0 0 10px rgba(0,0,0,0.5); color: #fff; overflow: hidden;}
.project_full .proj_title {width: 390px;}
.project_full .proj_title h3 {font: 32px/40px 'Open Sans', Helvetica, Arial, Verdana, clean, sans-serif; font-weight: bold; margin-top: 20px; margin-bottom: 20px; display: inline-block; padding: 5px 10px; background: url(../img/project_expanded_content_bg.png) repeat;}
.project_full .proj_title a.proj_link {display: inline-block; width: 27px; line-height: 40px; text-indent: -9999px; margin-left: 10px; background: url(../img/project_link.png) 2px 10px no-repeat;}
.project_full .proj_details {width: 370px; padding: 10px; min-height: 250px; background: url(../img/project_expanded_content_bg.png) repeat; margin-bottom: 20px;}
.project_full .proj_details .requirements {font: 16px/22px 'Open Sans', Helvetica, Arial, Verdana, clean, sans-serif; font-weight: bold; margin-top: 15px;}
.project_full .proj_details .overview {margin-top: 20px; font: 14px/22px 'Open Sans', Helvetica, Arial, Verdana, clean, sans-serif;}
.project_full .proj_details .services {margin-top: 25px; font: 12px/18px 'Open Sans', Helvetica, Arial, Verdana, clean, sans-serif;}
.project_full .proj_details .services ul li {list-style-type: none; display: inline-block; letter-spacing: 0px; margin-right: 10px; background: #181818; padding: 3px 10px; border-radius: 100px; cursor: pointer;}
.project_full .proj_details .services ul li:hover {background: #499dcf;}
.project_full .proj_preview {width: 773px; height: 500px; position: relative; right: -420px; bottom: 370px;}
.project_full .proj_preview a.proj_enlarge {display: block; width: 100%; height: 100%; text-indent: -9999px; background: url(../img/project_enlarge.png) 45% 40% no-repeat;}
.project_full .proj_preview a.proj_enlarge:hover {background: url(../img/project_enlarge_hover.png) 45% 40% no-repeat;}


推荐答案

如下(删除注释掉的内容,并添加其余内容):

Change your CSS as follows (deleting what's commented out, and adding the rest):

.project_full .wrapper {
    position: relative;
}
.project_full .prof_preview {
    /* position: relative; */
    /* right: -420px; */
    /* bottom: 370px; */
    position: absolute;
    left: 420px;
    top: 0; /* adjust to your liking */
}

-model,请参见这本经典的BrainJar文章。摔角的定位和浮动在CSS可以是可怕的(我有生动,可怕的回忆),但一旦你得到它,它的蛋糕。

For a great reference on the CSS box-model, see this classic BrainJar article. Wrestling with positioning and floats in CSS can be awful (I have vivid, terrible memories), but once you get it, it's cake.

这篇关于一个div的高度移动另一个为未知的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆