gpt4 book ai didi

html - 在 CSS 问题中为 下拉框的样式。 Using the code below, I am able to do this with one hiccup: when the text on the option becomes too wide, it doesn't cut off before the background image of the drop down arrow. 当文本太长时: 我想要完成的是在下拉箭头图像之前切断文本,这样它们就不会重叠。但是,我仍然希望在展开下拉列表时显示全文: 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Styling Selects</title> <style type="text/css"> .selectDiv select { background: transparent; width: 250px; padding: 7px; font-size: 16px; border: none; height: 34px; text-transform: lowercase; color: #666666; z-index: 100; position: absolute; left: 0px; top: 0px; } .selectDiv { border: 2px solid #666666; display: block; width: 218px; height: 34px; overflow: hidden; position:relative; display: inline-block; } .selectButtonDiv { width: 16px; height: 16px; z-index: 99; position: absolute; left: 190px; top: 9px; display: inline-block; background: url("stream_7B0046.png") no-repeat -96px #FFF; } </style></head><body> <div class="selectDiv"> <div class="selectButtonDiv"></div> <select> <option value="Option 1">Option 1</option> <option value="Option With Really Long Name">Option With Really Long Name</option> </select> </div></body></html>关于如何在显示折叠的下拉框时修剪文本但在展开时仍显示完整文本的任何想法。所有这一切都完全保留在 CSS 中。谢谢! 最佳答案 我的第一个建议是使 select 足够宽以说明您的最大字符数。我相信您已经想到了,但它不可用。 我的第二个建议是添加 Javascript,尤其是 jQuery DD,以用可以更轻松设置样式的定义列表替换 select options。 https://github.com/HenrikJoreteg/jquery.dd 关于html - 在 CSS 问题中为 <select> 设置样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10805178/ 上一篇:html - 在 div 的右下方 float 一个 span 下一篇:c# - 如何在 asp.net mvc3 中显示矩阵表? 相关文章: html - 关闭下拉框后更改 <select> 背景颜色 jquery - 动态显示更改 iframe 滚动 javascript - 文本区域选择索引 MySQL - 从另一个表中为 WHERE 子句选择数据 html - 父项下的 CSS 子菜单 javascript - 使用 javascript 打印 HTML 元素的内联样式值 html - 在绝对对齐的容器中将 div 并排 float html - 如何自定义两个不同颜色的select标签? c# - Mysql DB 返回错误的日期格式 (C#) html - Flexbox:在屏幕中间居中元素 ©2023 IT工具网  联系我们

24 4 0
文章推荐: android - 创建自定义 Annotation ButterKnife
文章推荐: c - C 中 printf 和 scanf 函数的定义/主体
文章推荐: char *name[] 指针数组还是指向数组的指针?
文章推荐: c - 如何以 2013-01-11 23 :34:21? 格式获取日期和时间
太空狗
个人简介

我是一名优秀的程序员,十分优秀!

滴滴打车优惠券免费领取
滴滴打车优惠券
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com