2014-10-16 59 views
-4

我在CSS按钮生成器上创建了一个按钮,无法将其链接到浏览器中显示。 一个按钮正在为浏览器生成,但它只是一个标准的html按钮。 当前的代码是:使用html的CSS按钮创建器链接

  <!DOCTYPE html> 
<html> 
<body> 


.btn { 
    background: #3498db; 
    background-image: -webkit-linear-gradient(top, #3498db, #2980b9); 
    background-image: -moz-linear-gradient(top, #3498db, #2980b9); 
    background-image: -ms-linear-gradient(top, #3498db, #2980b9); 
    background-image: -o-linear-gradient(top, #3498db, #2980b9); 
    background-image: linear-gradient(to bottom, #3498db, #2980b9); 
    -webkit-border-radius: 0; 
    -moz-border-radius: 0; 
    border-radius: 0px; 
    text-shadow: 0px 0px 0px #666666; 
    font-family: Arial; 
    color: #ffffff; 
    font-size: 38px; 
    padding: 40px; 
    text-decoration: none; 
} 

.btn:hover { 
    background: #3cb0fd; 
    background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db); 
    background-image: -moz-linear-gradient(top, #3cb0fd, #3498db); 
    background-image: -ms-linear-gradient(top, #3cb0fd, #3498db); 
    background-image: -o-linear-gradient(top, #3cb0fd, #3498db); 
    background-image: linear-gradient(to bottom, #3cb0fd, #3498db); 
    text-decoration: none; 
} 


<button type = "btn">Entry forms</button> 
</body> 
</html> 
+1

什么是你的问题? – 2014-10-16 15:18:30

+1

并且这<按钮类型=“BTN”>条目形成被<按钮类=“BTN”>条目形成 – WhiteLine 2014-10-16 15:19:17

+0

我怎样才能CSS代码链接到我的按钮,并显示它的CSS代码在浏览器中。 – 2014-10-16 15:19:22

回答

1

你需要在你的HTML指定btn类:

<button class="btn">Entry forms</button> 

而且,你的CSS需要在里面<style>代码会在HTML的<head>部分。

更新:全码

<html> 
 

 
<head> 
 
    <style type="text/css"> 
 
    .btn { 
 
     background: #3498db; 
 
     background-image: -webkit-linear-gradient(top, #3498db, #2980b9); 
 
     background-image: -moz-linear-gradient(top, #3498db, #2980b9); 
 
     background-image: -ms-linear-gradient(top, #3498db, #2980b9); 
 
     background-image: -o-linear-gradient(top, #3498db, #2980b9); 
 
     background-image: linear-gradient(to bottom, #3498db, #2980b9); 
 
     -webkit-border-radius: 0; 
 
     -moz-border-radius: 0; 
 
     border-radius: 0px; 
 
     text-shadow: 0px 0px 0px #666666; 
 
     font-family: Arial; 
 
     color: #ffffff; 
 
     font-size: 38px; 
 
     padding: 40px; 
 
     text-decoration: none; 
 
    } 
 
    .btn:hover { 
 
     background: #3cb0fd; 
 
     background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db); 
 
     background-image: -moz-linear-gradient(top, #3cb0fd, #3498db); 
 
     background-image: -ms-linear-gradient(top, #3cb0fd, #3498db); 
 
     background-image: -o-linear-gradient(top, #3cb0fd, #3498db); 
 
     background-image: linear-gradient(to bottom, #3cb0fd, #3498db); 
 
     text-decoration: none; 
 
    } 
 
    </style> 
 
</head> 
 

 
<body> 
 
    <button class="btn">Entry forms</button> 
 
</body> 
 

 
</html>

+0

因此,替换“按钮类型”行并替换类? – 2014-10-16 15:26:05

+0

我刚刚试过这个,而按钮仍然没有显示在铬 – 2014-10-16 15:26:33

+0

我增加了全套的代码给我你的答案 – Kabb5 2014-10-16 15:53:36