How to add a grain type look to background-color - css

Notice the blue sidebar has a grain effect added to it.
How to I achieve this without using an image?

You can create a textured image with only a few colours to achieve a grain effect. As a GIF or similar, it will only amount to a few hundred bytes if you do it right. That is, make a small image and tile it.
If you want to find out how a specific site achieved that effect, use a DOM inspector to check the code behind the element. Chrome has this functionality built-in if you right click and choose "Inspect Element". I bet you'll find there's a background image.

Related

Custom shaped menu with shadow in Qt

I'd like to create a context menu looking similar to this one:
I read suggestions on the web that QWidget::setMask() should be used to create a shape. But how can it fit the variable number of items then? Moreover, the same menu item may take more or less screen space on different machines.
Another question is how to create a shadow around this custom shape? As far as I understand, the mask allows to crop the widget, but not to make it semi-transparent.
I don’t found an easy way to do that! But here goes a way!
Instead of using the Qt mask API, I've used a frame-less widget with transparency enabled!
To draw the shadow, I've used radial gradient!
You can change the size of the menu before opening it, however you can’t resize it after opened (for example resize with mouse).
It’s quite easy add or remove widgets, just respect the layout margin to not draw outside the bounds destined to widgets. To simplify your life I created an inherited class of QPushButton with colors you can easily customize with style sheet.
See the result:
You can browse the source
Hope that helps!

Only show group once while tiling with SVG

I'm designing a website which uses a SVG-document as background. I want this image to tile on the X-axis. Which works great, but I wanted to know if it is possible to show one group in the SVG only once, such that in subsequent tiles the group is hidden.
The above image visualizes what I want to achieve. The image having one group (in the image the red circle) that is invisible in the following tiles.
Now I am aware such things can be achieved using additional CSS backgrounds but I am really interested if such thing could be achieved using a single SVG background.
Thanks in advance!
The answer is no. If you are relying on CSS to tile the background - ie. with repeat-x, then no. there isn't any way to do what you want. When an SVG is used as a background like that, it becomes immutable - effectively the same as a PNG or a JPEG.
You will need to use a different method.

Curved bottom corners facing outward, like in Office Ribbon tabs, using CSS

At work i am given a task to create a simple menu UI that resembels the Ribbon UI. It doesn't have to be that sophisticated or nice looking, but it needs to have a specific look that I don't know how to do.
I need to make the bottom of a selected tab round, but facing outwards, just like in Office. It was easy to make the top of a selected tab round using CSS3 (border-top-left-radius:4px and same for right), which is supported in all modern browsers (we don't need round corners on old browsers. They can easily upgrade if they want to :) ). But if I use border-bottom-left-radius:4px on a selected tab, it has the normal round bottom corner, facing inwards, not outwards (sorry for my bad english).
Can it be achieved somehow using CSS3?
If I understand correctly, than this is what you want: http://jsfiddle.net/U84ng/
This is faking a little, and gets more complex when your background is an image instead of solid color. But unless it's an image that changes horizontally (ie. not a gradient or pattern) and your tabs aren't flexible in width (depending on text width, rather than one fixed in css) it can be done.

CSS: Howto Create Tab Foot?

With most modern browsers is easy to create rounded corners in CSS, so I was wondering if its posible to create a rounded corner that bend outwards or if I still need to fire up PhotoShop for creating such an effect.
The bottom foot in "See tab" from the picture below demonstrates what I am trying to do with CSS:
note: I am unsure if foot is the correct word for this (which have made googling it hard) so if anyone knows the real (or better) term then please let me know and I will update the question accordingly.
Chop that problem up into segments so that the illustration would have a blue shape with one rounded corner on top of a white background, next to the "See" tab, and so on. By picking the colors carefully, and using shapes that you know you can generate, you can establish a pattern that will work with the tools available.
Notice that you do not have to round all corners on a rectangle. You can specify, for example, bottom right.
Reference: http://www.css3.info/preview/rounded-border/

Change background of image maps on mouse hover

In my website I have an image as the navigation bar and have created hotspots to link them to different pages. The problem is since the text is a part of the image, I cannot change the style of the text on hover. Whereas I want the text/the hotspot to stand out on mouseover, so I learn the background color could be changed on mouse over. Is that possible? Is there a way to do that in CSS, using the area or maps. If Javascript is to be used, could someone help me out with it.
Is there a reason you've used a single image as the nav bar?
Instead of a single image with hotspots, I'd use an individual image for each navigation link. That way you can easily change the image (or use CSS image positioning) on hover. This is described here:
http://css-tricks.com/video-screencasts/7-three-state-menu/
along with many other places I'm sure.
I don't think it's a good idea to use neither image maps nor individual images.
Instead, use CSS sprites: a single image file, add that as a background image to the menu links, but position the background images differently. See this Line 25 tutorial for more information.

Resources