Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS using single property classes for multiple elements

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33781
    fishnfrogs
    Member

    Hello everyone! I’m building a website where everything will be positioned absolutely on the page. The idea behind it is to have the whole site built without scrollbars and for all the elements to slide in and out. Would it be better to have individual classes where the position is solely defined or just place the positioning within the div’s styling. For example is it better to have:





    or





    I have several elements that would be using classes like that. I’m not sure which is more efficient though. Any thoughts? Thanks in advance!

    #84418
    Kermet
    Member

    I think the first approach could be more clear, but i’d group the css declarations like this:


    #element, #element2 {
    position:absolute;
    bottom:0;
    }
    #element { width:100%; }
    #element2 { width:500px; }
    #84455
    shazdeh
    Member

    If you’re looking for efficiency, use CSS transform, which is supported even in IE9 (http://caniuse.com/#search=transform). It’s so smooth when you animate these with CSS transition!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.