English 中文(简体)
亲子休息
原标题:Break out of parent div s
  • 时间:2010-09-11 12:39:02
  •  标签:
  • css
  • html

When i have a div with position: absolute, and in it is another div with position: absolute the inner div will position in the frame given through the outer (wrapper) div. Now i want to create a class (css) called error_message that positions itself exactly in the center middle of the site, indifferent from where the it is called, so i need it to break out of every div wrapped around the error_message div.. how do i do this?

最佳回答

i 还有一个类似的问题,即把位于浮图纽特以下的斜体放在一起。

对我来说,解决办法是使用“定位”财产“固定”价值。

position: fixed

then you can position your error message from top left of the body again. i use another wrapper div to position all hoover texts center center.

“entergraph

找到解决办法:

职位绝对差别?

从你看到的照片来看,这部法典并不是法典,只是说明。

http://lesscss.org/“rel=“noretinger” http://lesscss.org/<

<style>
    .button
    {
        float: left;
        position: relative;

        a
        {
            &:hover, &:focus
            {
                .titlePos
                {
                    .title
                    {
                        display: block;
                    }
                }
            }
            .titlePos
            {
                position: fixed;
                top:50%;
                left:50%;
                width: 400px;
                margin-left: -200px;

                .title
                {
                    position:relative;
                    display: none;
                    top: 130px;
                    text-align: center;
                }
            }
        }
</style>

html:

<div id="wrapper">
    <div id="content">
        <ul>
            <li>
                <div class="button">
                    <a href="#" >
                        <div class="buttonImage">
                            <img />
                        </div>
                        <div class="titlePos">
                            <div class="title">Button Hoover Text1</div>
                        </div>
                    </a>
                </div>
            </li>
            <li>
                <div class="button">
                    <a href="#" >
                        <div class="buttonImage">
                            <img />
                        </div>
                        <div class="titlePos">
                            <div class="title">Button Hoover Text2</div>
                        </div>
                    </a>
                </div>
            </li>
            <li>
                <div class="button">
                    <a href="#" >
                        <div class="buttonImage">
                            <img />
                        </div>
                        <div class="titlePos">
                            <div class="title">Button Hoover Text3</div>
                        </div>
                    </a>
                </div>
            </li>
            <li>
                <div class="button">
                    <a href="#" >
                        <div class="buttonImage">
                            <img />
                        </div>
                        <div class="titlePos">
                            <div class="title">Button Hoover Text4</div>
                        </div>
                    </a>
                </div>
            </li>
        </ul>
    </div>
</div>
问题回答

您应尝试使用<代码>:固定的 property,而不是position:absolute,用于“代码>div> :固定的将定位基于浏览器窗的元件,而不考虑其位于OMD。 如果你想要把它放在窗户上,不管窗户大小,你可以把固定位置分散到整个屏幕上(<条码>:0、<条码>:0等)。 之后将错误信息放在文字上。

我想有一个<代码>div的唯一途径。 打破所有母体的<条码>div,即对所有母体实行绝对定位,这显然将产生自己的一套问题。

为什么不能简单地将“<>div><>div作为身体的直接子女,而不是在标识中加以包装。 然后,你可以轻易地将其定位为你所希望,并在网站div,并动态地将错误信息插入其中。 我甚至建议查看。 Query UI允许你除了其他特征的吨位外,容易制造正常和模式的方言。


<>>>>>

由于不允许提交联合材料,只有出现错误,这样做的容易方式才会显示四分五裂。 因此,购买力平价代码为......。

if (isset($error)) {
    echo  <div class="show_error">  . $error .  </div> ;
}

......和CSS级为......

.show_error {
    width: 400px; // error element s width
    height: 200px; // error element s height
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -100px; // minus half the height
    margin-left: -200px; // minus half the width
}

当然,你可以像你所希望的那样,进一步模仿这一错误,但需要将这些错误定位为死因。

希望这一帮助!





相关问题
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!

热门标签