2017-07-29 36 views
-2

我用enjoycss來創建一些css組件,然後獲取代碼。對於一個按鈕,我得到了在php腳本中使用css類

.mybutton-css { 
    display: inline-block; 
    -webkit-box-sizing: content-box; 
    -moz-box-sizing: content-box; 
    box-sizing: content-box; 
    cursor: pointer; 
    padding: 10px 20px; 
    border: 1px solid #018dc4; 
    -webkit-border-radius: 3px; 
    border-radius: 3px; 
    font: normal 16px/normal Tahoma, Geneva, sans-serif; 
    color: rgba(255,255,255,0.9); 
    -o-text-overflow: clip; 
    text-overflow: clip; 
    background: #0199d9; 
    -webkit-box-shadow: 2px 2px 2px 0 rgba(0,0,0,0.2) ; 
    box-shadow: 2px 2px 2px 0 rgba(0,0,0,0.2) ; 
    text-shadow: -1px -1px 0 rgba(15,73,168,0.66) ; 
    -webkit-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1); 
    -moz-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1); 
    -o-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1); 
    transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1); 
} 

但是,從我在教程中看到,因爲他們使用不同.button,但我沒有看到。我也不知道該怎麼稱呼它!我應該創建一個名爲mybutton-css.txt的文件嗎?在test.php,我有

<html> 
<head> 
<title> Hello </title> 
</head> 
<body> 
    <?php 
     print("hello world"); 
     <input type="button" class="mybutton-css" value="Load File" /> 
    ?> 


</body> 
</html> 
+3

你真的需要先從一些基本教程導入它在你的HTML。您的示例中沒有任何內容需要PHP,並且您發佈的代碼中會有一個很大的語法錯誤。你可以選擇你的類名 - 它可以是'.button','.mybutton-css'或'.whatever-the-he-you-want-it-to-be-be'。 – ceejayoz

+0

這個問題很不清楚。請解釋你正在努力完成什麼,實際發生了什麼,以及你的困惑來自何處。此外,由於這似乎是一個CSS問題,爲什麼你的PHP代碼在中間? (順便說一下,你的標籤應該在PHP之外,而不是在裏面) – Nathanael

+0

(另一方面注意:停止使用該生成器,它將大量毫無意義和不必要的複雜垃圾投射到你的CSS中,這可能會讓你非常困惑。真的很簡單的學習CSS規則。) – ceejayoz

回答

1

我不知道你想要什麼,以實現與PHP,但 - 根據您的演示 - 你不需要任何PHP的。

你只需要下面的CSS和HTML:

.mybutton-css { 
 
    display: inline-block; 
 
    -webkit-box-sizing: content-box; 
 
    -moz-box-sizing: content-box; 
 
    box-sizing: content-box; 
 
    cursor: pointer; 
 
    padding: 10px 20px; 
 
    border: 1px solid #018dc4; 
 
    -webkit-border-radius: 3px; 
 
    border-radius: 3px; 
 
    font: normal 16px/normal Tahoma, Geneva, sans-serif; 
 
    color: rgba(255,255,255,0.9); 
 
    -o-text-overflow: clip; 
 
    text-overflow: clip; 
 
    background: #0199d9; 
 
    -webkit-box-shadow: 2px 2px 2px 0 rgba(0,0,0,0.2) ; 
 
    box-shadow: 2px 2px 2px 0 rgba(0,0,0,0.2) ; 
 
    text-shadow: -1px -1px 0 rgba(15,73,168,0.66) ; 
 
    -webkit-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1); 
 
    -moz-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1); 
 
    -o-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1); 
 
    transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1); 
 
}
hello world 
 
<input type="button" class="mybutton-css" value="Load File" />

對於現實世界的應用程序,你通常把你的CSS在名爲像style.css一個CSS文件。

然後,你在你的HTML文檔的頭以下標記添加CSS:

<link rel="stylesheet" href="style.css" /> 

你會把這在HTML文檔正文:

hello world 
<input type="button" class="mybutton-css" value="Load File" /> 
0

你應該粘貼到你的<head>標籤<style>標籤內您的生成CSS代碼

<html> 
    <head> 
     <style> 
      .mybutton-css { 
       //Your generated CSS code here 
      } 
     </style> 

更妙的是,你應該創建一個style.css文件,並與

<link rel="stylesheet" href="style.css"/>