本文介绍了CSS:“right”财产拒绝申请?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我很疯狂!



我有两个div,紧跟在body标签之后。他们都是绝对的定位和大小。他们都有相同的左属性,但我后来声明第二个div的右属性(所以左应该忽略!)。



HTML:

 < body> 

< div class =previousPageButton>< / div>
< div class =nextPageButton>< / div>

和CSS:(有更多的代码,但它被注释掉所以它是无关的) p>

  .previousPageButton,.nextPageButton {
position:absolute;
top:0px; left:0px;
display:block;
height:500px ;;
width:100px;
background:transparent url(../ images / buttons / arrow_previousPage.png)no-repeat center center;
z-index:2;
opacity:.1;
}

.nextPageButton {
top:0px; right:150px;
background:transparent url(../ images / buttons / arrow_nextPage.png)no-repeat center center;
}

正如你可以看到,BELOW第一个CSS,我声明 ,我有另一个CSS块,我特别声明的右属性.nextPageButton。身体是相对定位,像往常一样,所以它应该工作!在声明right属性之前,我需要取消设置left属性吗?这是可能的吗?



我知道我可以从第一个代码块撕开左属性,然后分配每个div它自己的左/右属性..

解决方案

<$> c $ c> left 和 right 不是互斥的。



具有属性集,。



如果您要删除/重置那么您应该应用 left:auto



您可以查找属性的初始值 a href =https://developer.mozilla.org/en/CSS/left>这里是


This is driving me crazy!

I have two divs, right after the body tag. They are both absolute positioned and sized. They both have the same "left" property, but i later declare the "right" property for the second div (so "left" should be ignored!).

Here's the HTML:

<body>

<div class="previousPageButton"></div>
<div class="nextPageButton"></div>

And the CSS: (There's more code to it but it's commented out so it's irrelevant.)

.previousPageButton, .nextPageButton {
    position: absolute;
    top: 0px; left: 0px;
    display: block;
    height: 500px;;
    width: 100px;
    background: transparent url(../images/buttons/arrow_previousPage.png) no-repeat center center;
    z-index: 2;
    opacity: .1;
}

.nextPageButton {
    top: 0px; right: 150px;
    background: transparent url(../images/buttons/arrow_nextPage.png) no-repeat center center;
}

As you can see, BELOW the first CSS where i declare the "left", i have another block of CSS where i specifically declare the "right" property for .nextPageButton. Body is relatively positioned, as usual, so it should work! Do i need to "unset" the "left" property before declaring the "right" property? Is that even possible?

I know i could rip the "left" property out of the first codeblock, and then assign each div it's own left/right property.. but this should still work!

Any thoughts?

解决方案

left and right are not mutually exclusive.

An element can have both the left and right properties set, like this.

If you want to "remove"/"reset" left, then you should apply left: auto.

You can lookup the "inital value" of properties, for example here's left.

这篇关于CSS:“right”财产拒绝申请?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:44