A little something about everything

internet marketing and website development made simple..

How to center an element (div, span, etc) using css3

In order to target a div you can do so by id or by class, for example

<div id="centerme" class="centerit">some content</div>

here is the css:

#centerme {
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
/* in some cases you may want to give it a width and height first */
height:100%;
max-height: 10rem;
width: 100%;
max-height: 20rem;
}
/* another option only vertical via class rather than id */
.centerit {
top: 50%;
transform: translateY(-50%);
}
/* or only horizontal  */
.centerit {
left: 50%;
transform: translateX(-50%);
}

That's it!

text-shadow not working in chrome, css tricks

Here is the sample,

Text Shadow

And with no further adieu, here is the code:

for chrome:

  • text-shadow: -3px 3px 2px rgba(0,0,0,1);

For MS Browsers:

  • text-shadow: -3px 3px 2px 1px rgba(0,0,0,1)

For Both:

  • text-shadow: -3px 3px 2px rgba(0,0,0,1)
  • text-shadow: -3px 3px 2px 1px rgba(0,0,0,1)
Since CSS is read top down you can just place the version needed for crome above the general use/preferred method.