我有一个背景的跨度,我希望在不丢失收音机的情况下调整图像大小。我的意思是不伸展。当我使用height:auto;
时,我的图像消失了#logo_span{
display: inline;
background-image: url("../gfx/hs_logo.png");
margin: -5px auto auto -100%; /* margin top right bottom left */
background-size: 50% 50%;
background-repeat: no-repeat;
width: 90%;
height: auto;
}
答案 0 :(得分:0)
如果您希望自适应图片使用public class Controller {
@FXML
private TextField txtField;
@FXML
private PasswordField passField;
@FXML
private Button btn;
@FXML
private Label access;
private String USNM = "crimsoncoder";
private String PASS = "toor";
private static final String ACCESS_GRANTED = "/ACCESS_GRANTED/";
private static final String ACCESS_DENIED = "|/?ACCESS_DENIED?/|";
public void onClick() {
String usnm = txtField.getText();
String pass = passField.getText();
if (usnm.equals(USNM)) {
if (pass.equals(PASS)) {
access.setText(ACCESS_GRANTED);
} else {
access.setText(ACCESS_DENIED);
}
} else {
access.setText(ACCESS_DENIED);
}
}
}
代码而不是css <img/>
。然后在css中使用background-image