English 中文(简体)
边缘化和负差
原标题:Margins and negative margins

我总是认为我理解边际和消极的边际,但显然我不! 我刚刚开始新的设计,并陷入已经存在的问题。

我有一部分(先令)和另一批(先令)被nes到内,这是为他们提供的社会保障。

#hill3Cont
{
    width: 100%;
    background-image: url("images/grass.jpg");
}
#hill3Hill 
{
    margin: -100px 0 0 0;
    height: 600px;
    width: 100%;
    background: url("images/hill3.png") no-repeat center top;
}

我对孩子的顶部适用了消极的宽度,希望它将把这一内容推到父母的外围。 但它没有变化。 如果我适用积极的差值,就会把父母与子女一起 d。

我能够正确行事的唯一途径是使用边界或隐藏在母体上的过量,但设计却为其中任何一个(我不想要一个边界,而且过量隐藏着孩子)。

Maybe it s just been a long day and I m missing something common! Many thanks in advance.

Edit: I have got a solution, I ve put a single padding top on the parent div, padding: 1px 0 0 0. It works for my design so I m happy but still keen to find out what s happening.

问题回答

对父母内的儿童则使用相对和负上的地位。

#hill3Cont
{
    margin-top: 50px;
    width: 200px;
    height: 200px;
    background-color: red;
}
#hill3Hill 
{
    height: 50px;
    width: 100px;
    background: blue;
    position: relative;
    top: -20px;
}




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签