wildcard * in CSS for classes

What you need is called attribute selector. An example, using your html structure, is the following: div[class^=”tocolor-“], div[class*=” tocolor-“] { color:red } In the place of div you can add any element or remove it altogether, and in the place of class you can add any attribute of the specified element. [class^=”tocolor-“] — starts with … Read more

Using jQuery to center a DIV on the screen

I like adding functions to jQuery so this function would help: jQuery.fn.center = function () { this.css(“position”,”absolute”); this.css(“top”, Math.max(0, (($(window).height() – $(this).outerHeight()) / 2) + $(window).scrollTop()) + “px”); this.css(“left”, Math.max(0, (($(window).width() – $(this).outerWidth()) / 2) + $(window).scrollLeft()) + “px”); return this; } Now we can just write: $(element).center(); Demo: Fiddle (with added parameter)

Can I use a :before or :after pseudo-element on an input field?

:before and :after render inside a container and <input> can not contain other elements. Pseudo-elements can only be defined (or better said are only supported) on container elements. Because the way they are rendered is within the container itself as a child element. input can not contain other elements hence they’re not supported. A button … Read more

How to remove close button on the jQuery UI dialog?

I have found this worked in the end (note the third line overriding the open function which find the button and hides it): $(“#div2”).dialog({ closeOnEscape: false, open: function(event, ui) { $(“.ui-dialog-titlebar-close”, ui.dialog || ui).hide(); } }); To hide the close button on all dialogs you can use the following CSS too: .ui-dialog-titlebar-close { visibility: hidden; … Read more

CSS force image resize and keep aspect ratio

img { display: block; max-width:230px; max-height:95px; width: auto; height: auto; } <p>This image is originally 400×400 pixels, but should get resized by the CSS:</p> <img width=”400″ height=”400″ src=”http://i.stack.imgur.com/aEEkn.png”> This will make image shrink if it’s too big for specified area (as downside, it will not enlarge image).

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)