我按照this指南将页脚放在页面底部。这是我的HTML的样子:
<body>
<div class="page">
<header></header>
<div class="wrapper">
<div class="leftA"></div>
<div class="rightA"></div>
</div>
<footer>
<p class="copyright">
</footer>
</div>
CSS:
footer, .wrapper::after {
display: block;
height: 9em;
clear: both;
width: 100%;
background-color: #808080;
border-radius: 0.3em;
}
在遵循上述指南之前,我可以使用以下css更改此段落的颜色,位置和其他属性:
p.copyright {
margin-left: 3em;
top: 5em;
left: 1em;
bottom: 0;
width: 25%;
color: white;
background-color: #808080;
}
但现在它已经不再适用了。如果您需要其他数据,请与我们联系。谢谢!
这是Firefox“Inspect element”的样子(除了继承之外没有应用任何样式): enter image description here
答案 0 :(得分:0)
您在<div class="rightA></div>
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class Test {
public static void main(String[] args) {
new Test();
}
public Test() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
}
JFrame frame = new JFrame("Testing");
frame.setUndecorated(true);
frame.setBackground(new Color(0, 0, 0, 0));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new TestPane());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
public class TestPane extends JPanel {
public TestPane() {
setOpaque(false);
setLayout(new GridBagLayout());
JLabel label = new JLabel("I'm on top");
label.setFont(label.getFont().deriveFont(Font.BOLD, 64));
label.setForeground(Color.WHITE);
add(label);
}
}
}