搜索引擎中的术语气泡
所以我会尽力描述我想做的事情,但我认为图片会更公正。
基本上我正在开发一个搜索引擎,该引擎接受逗号分隔的关键字。我希望它的工作方式是在用户输入一个术语并输入逗号后,该术语出现在搜索栏下方的一个大小适当的“气泡”中,并带有一个“x”,允许他们删除该术语从他们的搜索中。
从编程上来说,我知道该怎么做。不过,我对如何制作图形有点困惑。我知道这是一个编程论坛,但我不确定是否应该为气泡创建“基本”图形,然后根据搜索词的长度动态调整其大小,或者是否有其他方法可以做到这一点。
想法?
编辑:哇,刚刚想起 StackExchange 完全实现了我想要的功能,没有“x”选项。这就是我想要的,除了更圆润的样式。
So I'll do my best to describe what I'm trying to do, but I think a picture will do more justice.
Basically I'm working on a search engine of sorts and the engine accepts comma-delimited keywords. The way I'd like it to work is after the user enters a term and puts a comma, the term appears below the search bar in a "bubble" that is sized appropriately, with an "x" that allows them to remove the term from their search.
Programmatically, I know how to do it. I'm a little stuck on how to do the graphics though. I know this is a programming forum, but I'm not sure if I should create the "base" graphic for the bubble and then have it dynamically size based on the length of the search term, or if there's some other way to do it.
Thoughts?
EDIT: Wow, just remembered that StackExchange accomplishes exactly what I'm wanting, sans the 'x' option. That's what I want, except with more rounded styling.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
类似这样的事情:
……应该可以解决问题。除了删除图标之外,不需要玩图形。
Something along the lines of:
… should do the trick. No need to play with graphics except for the delete icons.
使用滑动门技术...
http://kailoon.com/ css-sliding-door-using-only-1-image/
然后有一个自动宽度,两侧都有填充。
Use the sliding doors technique...
http://kailoon.com/css-sliding-door-using-only-1-image/
and then have an auto width with padding either side.
您可以采用 HTML 5 方式向
li
的 /div
添加圆角。查看 border-radius 属性来了解这一点。尽管并非所有(旧版/IE:))浏览器都支持。
或者
您可以制作类似以下内容的内容(半伪代码):
它将有两侧(左/右),圆角作为图像和固定宽度。中间的内容部分没有固定的宽度。
编辑
第二种方式的演示:http://jsfiddle.net/kc5ZC/ 4/
我只是将左/右设置为相同的红色背景颜色。您必须为其创建带有圆角的左/右图像。
You can go either the HTML 5 way be adding rounded corners to
li
's /div
's.Look at the
border-radius
property for this. Although is isn't support by all (older / IE :) ) browsers.Or
You can make something like the follwing (semi pseudocode):
Which will have two sides (left / right) with the rounded corners as image and fixed width. And the middle content part which doesn't have a fixed width.
EDIT
Demo of the second way to go: http://jsfiddle.net/kc5ZC/4/
I just set the left / right with the same red background color. You would have to create left / right images with round corners for it.