直接上代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>demo</title>
<style>
.box {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
}
.sel {
width: 8rem;
border: none;
direction: rtl;
text-overflow: ellipsis;
color: #333;
}
.sel option {
direction: ltr;
}
</style>
</head>
<body>
<div class="box">
<span>保险名称</span>
<select name="cars" class="sel">
<option value="volvo">请输入</option>
<option value="volvo">海保人寿福佑金生重大疾病保险</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
</div>
</body>
</html>
页面展示效果:右对齐,超出宽度部分用省略号显示。
以上。