2015-09-14 50 views
0

我看了看,但我无法找到它。请解释为什么类中的图像:secondimage在下面的代码中根本没有移动。不应该所有的div都以相同的方式移动,不管它们是否有文字或图像?感谢您的任何帮助。移动一个div里面的图像?

<head> 
<style> 
html, body{ 
    margin: 0; 
    height: height: 100%; 
    } 
h1, h2, h3{ 
    font-family: "Arial", Helvetica, sans-serif; 
} 
.topp{ 
    margin-right: 500px; 
    background-image: url('gamerbeta.jpg'); 
    background-color: fff; 
    width: 100%; 
    height: 450px; 
    float: top; 
    box-shadow: 3px 3px 4px black; 
} 

.second{ 
    position: relative; 
    top: 0px; 
    background-color: white; 
    width: 100%; 
    height: 450px; 
    box-shadow: 3px 3px 4px black; 
} 
.secondword{ 
    position:absolute; 
    top: -50px; 
    left: 450px; 
    font-size: 50px; 
} 
.secondp{ 
    position:absolute; 
    top: 10px; 
    left: 1100px; 
    text-align: center; 
.secondimage{ 
    position: absolute; 
    top: 50px; 
    left: 1200px; 
} 

    .third{ 
    position: relative; 
    background-color: white; 
    width: 100%; 
    height: 450px: 
    box-shadow: 1px 1px 4px black; 
    } 
</style> 
</head> 

<body> 
<div class=topp></div> 

<div class=second> 
    <div class=secondword><h1>BETA</h1></div> 
    <div class=secondp><h2>EXCLUSIVE ACHIEVEMENT<br>FOR JOINING BETA</h2></div> 
    <div class=secondimage><img src="test.jpg" alt=""></div> 
</div> 

<div class=third> 

</div> 

</body> 
+0

需要移动的位置? –

+1

我不明白你的问题是什么,你的CSS在'.secondp'块中有一个错字(缺少'}')。 – j08691

+0

我不明白为什么某些东西应该“移动”。以上所有代码都是静态的,没有找到“移动”代码。 – shaochuancs

回答

0

您在“secondp”类之后缺少右括号。希望这可以帮助。

0

它看起来像一个语法错误。我建议在发布之前做的第一件事是通过像W3C这样的检查器/验证器来查找错误或运行代码。当我们没有发现我们的错误时,它可以创造奇迹。尝试https://jigsaw.w3.org,你可以看到你的CSS的所有问题。

0

也许如果你关闭支架} .secondp这将有所帮助。另请阅读有关使用absolute的位置,您可能会更好使用relative