2013-03-17 314 views
-1
.button1{ 


    background: #E68A00 url(wooden.jpg) repeat-x; 
    border: 2px solid #eee; 
    height: 28px; 
    width: 115px; 
    margin: 50px 0 0 50px; 
    padding: 0 0 0 7px; 
    overflow: hidden; 
    display: block; 
    text-decoration:none; 
    font-family: 'Sacramento', cursive; 
    color : white; 
    font-size: 30px; 




    /*Rounded Corners*/ 
-webkit-border-radius: 15px; 
-moz-border-radius: 15px; 
border-radius: 15px; 

/*Gradient*/ 
background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); 
background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); 
background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); 
background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); 
background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); 

/*Transition*/ 
-webkit-transition: All 0.5s ease; 
-moz-transition: All 0.5s ease; 
-o-transition: All 0.5s ease; 
-ms-transition: All 0.5s ease; 
transition: All 0.5s ease; 


} 

pg.button1{ 
position:absolute; 
right:0px; 
top:100px; 

} 

pg:hover { 
    width: 200px; 
} 






<pg <a class = "button1" href="http://www.google.com">Small $14 </a> </pg>## Heading ## 

上面的标签是一个链接,直到我引入了标签pg,这意味着将链接放置在屏幕上。原因是,我仍然想与其他对象一起使用该类!所以我不必重复我的代码!我创建了像p1 p2 p3 p4这样的标签以用于同一个类 它实际上可以定位它,但它不再是链接!这是为什么 ?我又如何得到这个工作?另一个标签内的标签html

+1

你错过了'>'在初始' '标签。这就是说,制作新标签是一个非常可疑的做法。 – Pointy 2013-03-17 18:47:25

回答

1

而不是发明新的标签,只是使用多个类。在这种情况下,这取决于你在做什么实际上试图做的,你可以这样做:

<a class="button1 pg" href="...">Small $14</a> 

或者这样:

<div class="pg"><a class="button1" href="...">Small $14</a></div> 
+0

谢谢,实际上修复了链接问题,但位置已经回到了左上角,关于如何解决这个问题的任何想法? – user2125086 2013-03-17 18:54:05

+0

你可能需要一个包含元素与'位置:相对' – 2013-03-17 18:55:21

+0

我试过,仍然没有工作 – user2125086 2013-03-17 18:57:44