简体   繁体   English

css 重复-x 右侧

[英]css repeat-x rightside

is it possible to repeat only right side of picture.是否可以只重复图片的右侧。 If I have a menu button picture, there are border or stripe on left side and I only want to repeat right side(without border).如果我有菜单按钮图片,左侧有边框或条纹,我只想重复右侧(无边框)。

When I'm just putting repeat-x scroll right or just repeat-x , the whole picture will repeat, but I only want right side to repeat, not left or whole picture.当我只是将repeat-x scroll right或只是repeat-x时,整张图片会重复,但我只希望右侧重复,而不是左侧或整张图片。

I hope you understand what I mean.我希望你明白我的意思。

按钮

This is button example.这是按钮示例。 When my button title is too long and it will need to repeat button picture.当我的按钮标题太长并且需要重复按钮图片时。 Can I only repeat that yellow part of picture?我可以只重复图片的黄色部分吗? not together with red.不与红色一起。 PS, Cant repeat color. PS,不能重复颜色。 because button is made with cradient.因为按钮是用十字形制作的。

Short answer, no, it's not possible.简短的回答,不,这是不可能的。

A picture has fixed-width and you can't stretch just a part of it.图片具有固定宽度,您不能仅拉伸其中的一部分。

Solution: use two pictures, one for the left side, with fixed size and other to the right side which you can use repeat-x to fill the remaining space.解决方案:使用两张图片,一张在左侧,固定大小,另一张在右侧,您可以使用repeat-x填充剩余空间。

EDIT:编辑:

If your button have a horizontal gradient, the best you can do is to make a picture wide enough to encompass "almost" all cases.如果您的按钮具有水平渐变,您可以做的最好的事情是使图片足够宽以涵盖“几乎”所有情况。 The key word here is almost because you can always find someone with a screen wider than the image itself.这里的关键词几乎是因为你总能找到屏幕比图像本身更宽的人。

Not sure why you can't use a solid color, but why not simply use a wider image?不知道为什么不能使用纯色,但为什么不简单地使用更宽的图像?

在此处输入图像描述

just put "no-repeat top right" is that what your meaning只是把“不重复右上角”这就是你的意思

Smashing Magazine has an excellent tutorial on designing buttons with CSS: Smashing Magazine 有一个关于使用 CSS 设计按钮的优秀教程:

http://www.smashingmagazine.com/2009/11/18/designing-css-buttons-techniques-and-resources/ http://www.smashingmagazine.com/2009/11/18/designing-css-buttons-techniques-and-resources/

Scroll down to the section "Sliding Doors: Flexible Buttons" , it explains exactly what you're looking for.向下滚动到“滑动门:灵活按钮”部分,它准确地解释了您在寻找什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM