If absolute positioning is an option, a simple, clean way is:

.centeredElement {
  position: absolute;
  margin: 0 auto;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  height: 300px;
  width: 300px;
}

http://codepen.io/chrisrockwell/pen/Ffjul


On Tue, Oct 1, 2013 at 8:39 AM, MiB <digital.disc...@gmail.com> wrote:

>
> 1 okt 2013 13.24 Karl DeSaulniers:
>
> > Last question for now. In your resizing box example,
> > how would you get the text to scale with box, as well as,
> > say an image and another div with an image in it?
> >
> > Is there a css way to do this besides zoom like a scale or
> transformMatrix or is zoom the way?
> > Or is jQuery the way and just traverse the .children().each() function?
>
>
> When I have this issue I use ems or more often percentages or some other
> unit that can be linked to the current font size to set also the size of
> the box as well as the font sizes within that box. This doesn't always work
> reliably depending on the situation, the selectors and the browsers that
> you want to support. There are other techniques too, but that's one.
>
> I strive to not have to rely on javascript for basic layout, but when you
> have very specific requirements you might have too, at least during the
> prototype phase. It's fine to use javascript for other types of effects in
> concert with CSS, but I don't want my layouts to fall down if javascript is
> turned off or unavailable.
> ______________________________________________________________________
> css-discuss [css-d@lists.css-discuss.org]
> http://www.css-discuss.org/mailman/listinfo/css-d
> List wiki/FAQ -- http://css-discuss.incutio.com/
> List policies -- http://css-discuss.org/policies.html
> Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
>



-- 
Chris Rockwell
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to