2016-09-14 180 views
1

這裏是我的代碼:如何使TextArea對焦風格與非對焦風格相同?

.text-area { 
    -fx-focus-color: transparent; 
    -fx-faint-focus-color: transparent; 
} 

的截圖如下(我重點最早出現的TextArea

enter image description here

我有以下問題:

  • 的重點TextArea頂部有灰色欄:如何刪除它?
  • 聚焦的邊框顏色是白色的,如何使它像非聚焦的邊框顏色?
  • 非聚焦TextArea有邊框陰影,如何去除它?

回答

2

下面的CSS類使TextArea看看都在專注,不要聚焦狀態下的相同:簡潔的白色背景,默認的邊框沒有陰影,頂部沒有「灰色」欄,沒有焦點突出顯示。

.text-area { 
    -fx-focus-color: transparent; 
    -fx-faint-focus-color: transparent; 
} 

.text-area .content { 
    -fx-background-color:-fx-control-inner-background; 
} 
.text-area:focused .content { 
    -fx-background-color:-fx-control-inner-background; 
} 

.text-area:focused { 
    -fx-background-color: linear-gradient(to bottom, derive(-fx-text-box-border, -10%), -fx-text-box-border), -fx-control-inner-background; 
    -fx-background-insets: 0, 1; 
    -fx-background-radius: 3, 2; 
} 
+0

你是對的,謝謝 – asullaherc

0

試試這個,改變顏色爲你想要的

.text-area:focused{ 
-fx-background-color: red; }