2014-03-12 138 views
0

下面我的單選按鈕我有一些諸如底部填充,而我不使用任何填充CSS語句單選按鈕的CSS樣式

enter image description here

.radio-button { 
-fx-font-family: "Arial"; 
-fx-font-size: 11; 
/* -fx-text-fill: rgb(255, 255, 255, 0.4);*/ 
-fx-text-fill: lightgoldenrodyellow; 
/* -fx-effect: dropshadow(one-pass-box , rgba(0, 0, 0, 0.6), 0, 0.0 , 0 , 1);*/ 
-fx-border-width: 0px; 

}

如何去除呢?這些單選按鈕似乎沒有很好地居中。

編輯:

這是樹,顯示父母單選按鈕

enter image description here

這是外觀

enter image description here

這裏充分CSS類

/* 
Created on : 20-gen-2014, 18.18.13 
Author  : Alberto Pedroni <[email protected]> 
*/ 


.pane { 
/*-fx-background-color: linear-gradient(#f0f8ff, #b0c4de);*/ 
//-fx-background-color: linear-gradient(cornsilk, tan); 
/*-fx-background-radius: 5,4,3,5; 
-fx-background-insets: 4,4,4,4;*/ 

} 

.tab { 

/* -fx-background-color: red; */ 
/* -fx-border-color: gray; 
-fx-border-radius: 4; 
-fx-border-width: 1;*/ 

/* -fx-background-color: linear-gradient(rgb(109,109,109), rgb(70,70,70)); */ 

/* -fx-border-color: red; 
-fx-border-radius: 4; 
-fx-border-width: 1;*/ 

} 

.tab-label { 
-fx-font-size: 12px; 
-fx-font-weight: bold; 
-fx-text-fill: #333333; 
-fx-effect: dropshadow(gaussian , rgba(255,255,255,0.5) , 0,0,0,1); 
-fx-background-color: linear-gradient(aliceblue, lightslategray); 
} 

.label { 

-fx-font-family: "Arial"; 
-fx-font-size: 11; 
/* -fx-text-fill: rgb(255, 255, 255, 0.4);*/ 
-fx-text-fill: lightgoldenrodyellow; 
/* -fx-effect: dropshadow(one-pass-box , rgb(0, 0, 0, 0.6), 0, 0.0 , 0 , 1);*/ 

/* -fx-text-fill: lightyellow; 
-fx-font-size: 12px; 
-fx-font-weight: bold;*/ 
/* -fx-effect: innershadow(gaussian , rgba(255,255,255,0.5) , 0,0,0,1);*/ 
} 

.label > .tool-bar { 

-fx-font-family: "Arial"; 
-fx-font-size: 11; 
/* -fx-text-fill: rgb(255, 255, 255, 0.4);*/ 
-fx-text-fill: black; 
/* -fx-effect: dropshadow(one-pass-box , rgb(0, 0, 0, 0.6), 0, 0.0 , 0 , 1);*/ 

/* -fx-text-fill: lightyellow; 
-fx-font-size: 12px; 
-fx-font-weight: bold;*/ 
/* -fx-effect: innershadow(gaussian , rgba(255,255,255,0.5) , 0,0,0,1);*/ 
} 

.button .text { 
-fx-effect: dropshadow(one-pass-box , rgba(0, 0, 0, 0.8), 0, 0.0 , 0 , -1); 
} 

.button { 
-fx-background-color: rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.8),#090a0c, 
    linear-gradient(#4a5661 0%, #1f2429 20%, #1f242a 100%), linear-gradient(#242a2e, #23282e), 
    radial-gradient(center 50% 0%, radius 100%, rgba(135,142,148,0.9), rgba(255,255,255,0)); 
-fx-background-radius: 7, 6, 5, 4, 3, 5; 
/* -fx-background-insets: -3 -3 -4 -3, -3, 0, 1, 2, 0;*/ 
-fx-font-family: "Arial"; 
-fx-text-fill: white; 
-fx-font-size: 12; 
-fx-text-fill: linear-gradient(white, #d0d0d0); 
/* -fx-padding: 10 20 10 20;*/ 
} 

.button-plot { 
-fx-text-fill: red; 
} 

.button:focused, .button:hover { 
-fx-background-color: 
    rgba(255, 255, 255, 0.08), 
    rgba(0, 0, 0, 0.8), 
    #090a0c, 
    linear-gradient(#4a5661 0%, #1f2429 20%, #1f242a 100%), 
    linear-gradient(#3f4950, #23282e), 
    radial-gradient(center 50% 0%, radius 100%, rgba(135,142,148,0.9), 
    rgba(255,255,255,0)); 
} 

.text-field, .text-area { 
-fx-font-size: 12; 
-fx-background-color: rgba(255, 255, 255, 0.3), linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.8) 50%), rgb(218, 226, 224); 
-fx-background-insets: 0 0 -1 0, 0, 1.5; 
-fx-background-radius: 6, 5, 4; 
-fx-padding: 6 10 4 10; 
-fx-effect: innershadow(gaussian, rgba(0, 0, 0, 0.8), 5, 0, 0, 2); 
-fx-font-family: "Arial"; 
} 

.text-area { 
-fx-padding: 6 5 6 5; 
} 

.text-field:focused, .text-area:focused { 
-fx-background-color: 
    rgb(235, 235, 235), 
    rgb(0, 0, 0), 
    rgb(255, 255, 255); 
} 

.check-box { 
-fx-font-family: "Arial"; 
-fx-font-size: 11; 
/* -fx-text-fill: rgb(255, 255, 255, 0.4);*/ 
-fx-text-fill: lightgoldenrodyellow; 
-fx-effect: dropshadow(one-pass-box , rgba(0, 0, 0, 0.6), 0, 0.0 , 0 , 1); 
} 

.combo-box, .choice-box { 
-fx-font-size: 11; 
-fx-background-color: rgba(255, 255, 255, 0.3), linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.8) 50%), rgb(218, 226, 224); 
-fx-background-insets: 0 0 -1 0, 0, 1.5; 
-fx-background-radius: 6, 5, 4; 
/* -fx-padding: 6 10 4 10;*/ 
-fx-effect: innershadow(gaussian, rgba(0, 0, 0, 0.8), 5, 0, 0, 2); 
-fx-font-family: "Arial"; 
-fx-text-fill: black; 
} 

.radio-button { 
-fx-font-family: "Arial"; 
-fx-font-size: 11; 
/* -fx-text-fill: rgb(255, 255, 255, 0.4);*/ 
-fx-text-fill: lightgoldenrodyellow; 
/* -fx-effect: dropshadow(one-pass-box , rgba(0, 0, 0, 0.6), 0, 0.0 , 0 , 1);*/ 

} 

.tool-bar{ 
-fx-background-color: linear-gradient(aliceblue, lightslategray); 
-fx-text-fill: black; 
} 

/*.titled-pane { 

}*/ 

.titled-pane:focused { 
-fx-text-fill: darkblue; 
} 

.titled-pane > .title { 

-fx-background-color: linear-gradient(aliceblue, lightslategray); 
-fx-background-insets: 0, 1, 2; 
-fx-background-radius: 5 5 0 0, 4 4 0 0, 3 3 0 0; 
-fx-padding: 0.166667em 0.833333em 0.25em 0.833333em; /* 2 10 3 10 */ 
} 

/*.titled-pane:focused > .title 
{ 
-fx-color: -fx-focus-color; 
}*/ 

/*.titled-pane > .title > .arrow-button 
{ 
-fx-background-color: null; 
-fx-background-insets: 0; 
-fx-background-radius: 0; 
-fx-padding: 0.0em 0.25em 0.0em 0.0em; 0 3 0 0 
}*/ 

/*.titled-pane > .title > .arrow-button .arrow 
{ 
-fx-background-color: -fx-mark-highlight-color, -fx-mark-color; 
-fx-background-insets: 1 0 -1 0, 0; 
-fx-padding: 0.25em 0.3125em 0.25em 0.3125em; 3 3.75 3 3.75 
-fx-shape: "M 0 0 h 7 l -3.5 4 z"; 
}*/ 

/*.titled-pane:collapsed > .title > .arrow-button .arrow 
{ 
-fx-rotate: -90; 
}*/ 

.titled-pane > *.content { 
/* -fx-background-color: linear-gradient(rgb(87, 87, 87), rgb(27, 27, 27));*/ 
/* -fx-background-color: linear-gradient(from 0% 0% to 0% 100%, rgb(102, 102, 102) 0%, rgb(0, 0, 0) 21%, rgb(102, 102, 102) 47%, rgb(0, 0, 0) 99%, rgb(0, 0, 0) 100%);*/ 
/* -fx-background-color: linear-gradient(rgb(70,78,95), rgb(40, 40, 40));*/ 
-fx-background-image: url("file:///C:/Users/utente/Desktop/Java/NewProjectX/Backgrounds/CoarseGrid.png"); 
-fx-background-repeat: repeat; 
-fx-background-color: 
    linear-gradient(#38424b 0%, #1f2429 20%, #191d22 100%), 
    linear-gradient(#20262b, #191d22), 
    radial-gradient(center 50% 0%, radius 100%, rgba(114,131,148,0.9), rgba(255,255,255,0)); 

/*-fx-background-color: 
-fx-box-border, 
linear-gradient(to bottom, derive(-fx-color,-02%), derive(-fx-color,65%) 12%, derive(-fx-color,23%) 88%, derive(-fx-color,50%) 99%, -fx-box-border); 
-fx-background-insets: 0, 0 1 1 1; 
-fx-padding: 0.167em;*/ 
} 

    .top-segment { 
-fx-background-color: rgba(255, 255, 255, 0.05); 
-fx-border-color: 
    transparent transparent rgba(255, 255, 255, 0.08) transparent, 
    transparent transparent rgba(0, 0, 0, 0.5) transparent; 
-fx-border-width: 1, 1.5; 
-fx-border-insets: -1, 0; 
} 

/*.titled-pane:focused > .title > .arrow-button .arrow 
{ 
-fx-background-color: white; 
}*/ 

.split-pane:horizontal > * > .split-pane-divider { 
/* -fx-border-color: transparent; */ 
/* -fx-box-border: transparent #BBBBBB;*/ 
/* -fx-background-color: transparent, -fx-inner-border-horizontal;*/ 
/* -fx-background-color: grey;*/ 
-fx-border-width: 0.1; 
/* -fx-background-insets: 0, 0 1 0 1;*/ 
} 

.split-pane *.horizontal-grabber { 
-fx-padding: 0; 
-fx-background-color: transparent; 
-fx-background-insets: 0; 
-fx-shape: " "; 
} 
+0

在圖像中它會出現你有重複的單選按鈕......你可以包括與此相關的HTML?否則,您可以使用'vertical-align'屬性來調整單選按鈕的位置。 – Ted

+0

請提供一個jsfiddle,我們可以看到您的問題。並且請添加與輸入相關的所有CSS。 – DonJuwe

+0

發佈您如何將這些單選按鈕添加到場景中。他們的父母是什麼? –

回答

3
.radio-button .radio { 
    -fx-background-insets: 0; 
} 

這可以幫助你。

+0

這實際上解決了這個問題@Rogutin。 '.radio {-fx-background-insets:0; }'應該滿足。 除了在CSS中定義自己的樣式外,您不能訪問內部節點。 '.radio'適用於「按鈕」本身。我有同樣的問題,ItachiUchiha幫我在那裏 – motaa

+0

編輯我以前的評論:「你不能通過setStyle()」訪問內部節點「 – motaa