/*CSS代码:*/
/*左对齐*/
.left {
text-align: left;
border: 1px dotted black;
width: 50%;
}
/*右对齐*/
.right {
text-align: right;
border: 1px dotted black;
width: 50%;
}
/*居中对齐*/
.center {
text-align: center;
border: 1px dotted black;
width: 50%;
}
/*两端对齐*/
.justify {
text-align: justify;
border: 1px dotted black;
width: 50%;
}
/*css3将一个div水平和垂直居中显示*/
.div1{
width: 100px;
height: 100px;
border: 4px solid red;
position: absolute;
text-align: center;
left:0;
right:0;
top: 0;
bottom: 0;
margin: auto;
/*50%为自身尺寸的一半*/
}
自定义选中样式
/*自定义选中样式(高级):: 通过 CSS 的 ::selection伪元素,可以修改选中时的背景高亮色 */
::selection {
background-color: rgba(255, 255, 0, 0.3); /* 黄色半透明 */
color: inherit; /* 保持文字颜色不变 */
}