GREY_50_PERCENT
时间: 2024-05-24 08:08:55 浏览: 142
GREY_50_PERCENT是CSS的颜色属性之一,表示灰色50%的色调。在HTML中可以使用该属性设置元素的背景色或字体颜色。
以下是使用CSS将元素的背景色设置为GREY_50_PERCENT的例子[^1]:
```css
background-color: #808080;
```
以下是使用CSS将元素的字体颜色设置为GREY_50_PERCENT的例子[^2]:
```css
color: #808080;
```
相关问题
转化为 lambda 表达式.registerWriteHandler(new CellWriteHandler() { @Override public void afterCellDispose(CellWriteHandlerContext context) { // 判断是否是标题 if (BooleanUtils.isNotTrue(context.getHead())) { WriteCellData<?> cellData = context.getFirstCellData(); WriteCellStyle writeCellStyle = cellData.getOrCreateStyle(); writeCellStyle.setBorderBottom(BorderStyle.THIN); writeCellStyle.setBorderLeft(BorderStyle.THIN); writeCellStyle.setBorderRight(BorderStyle.THIN); writeCellStyle.setBorderTop(BorderStyle.THIN); writeCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); } else if (BooleanUtils.isTrue(context.getHead())) { WriteCellData<?> cellData = context.getFirstCellData(); WriteCellStyle writeCellStyle = cellData.getOrCreateStyle(); writeCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); writeCellStyle.setShrinkToFit(true); writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); } } });
这段代码可以转换为以下的 lambda 表达式:
```
registerWriteHandler((CellWriteHandler) context -> {
if (BooleanUtils.isNotTrue(context.getHead())) {
WriteCellData<?> cellData = context.getFirstCellData();
WriteCellStyle writeCellStyle = cellData.getOrCreateStyle();
writeCellStyle.setBorderBottom(BorderStyle.THIN);
writeCellStyle.setBorderLeft(BorderStyle.THIN);
writeCellStyle.setBorderRight(BorderStyle.THIN);
writeCellStyle.setBorderTop(BorderStyle.THIN);
writeCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
} else if (BooleanUtils.isTrue(context.getHead())) {
WriteCellData<?> cellData = context.getFirstCellData();
WriteCellStyle writeCellStyle = cellData.getOrCreateStyle();
writeCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
writeCellStyle.setShrinkToFit(true);
writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
}
});
```
可以看到,lambda 表达式将原先的匿名内部类转化为了一个函数式接口的实现,代码更加简洁。
<div class="about skills"> <h2 class="title2">专业技能</h2> <div class="box"> <h4>HTML</h4> <div class="percent"> <div style="width: 50%;"></div> </div> </div> <div class="box"> <h4>CSS</h4> <div class="percent"> <div style="width: 52%;"></div> </div> </div> <div class="box"> <h4>JavaScript</h4> <div class="percent"> <div style="width: 20%;"></div> </div> </div> <div class="box"> <h4>java</h4> <div class="percent"> <div style="width: 45%;"></div> </div> </div> <div class="box"> <h4>javaweb</h4> <div class="percent"> <div style="width: 32%;"></div> </div> </div> <div class="box"> <h4>Sql</h4> <div class="percent"><div style="width: 45%;"></div></div> </div> </div>加入js鼠标事件
好的,您可以在每个技能的div标签内添加onmouseover和onmouseout属性,来实现鼠标移入移出时的效果。例如:
```
<div class="box" onmouseover="this.style.background='grey'" onmouseout="this.style.background='white'">
<h4>HTML</h4>
<div class="percent">
<div style="width: 50%;"></div>
</div>
</div>
```
在这个例子中,当鼠标移入box的div时,会将背景色改为灰色,当鼠标移出时,又将背景色改回白色。您可以根据自己的需求来修改鼠标事件的效果。
阅读全文