Jump to content

Same Box, Multiple Locations


turbospaz
 Share

Recommended Posts

Hi guysI have what is probably a simple question.I have a CSS tag that defines the dimensions and background color of a box (which will have text in it) as well as setting a font type and color. The problem is that this box is going to be used multiple times over the website, so when the location attributes (top, left etc.) get stores in the tag, it moves all other boxes using that same tag to the same spot.What would be the best way of having multiple boxes in different locations use the same tag? If I use the box 20 times, creating 20 different CSS tags seems wasteful.I was thinking of storing just the generic data in the CSS file (background color, font type etc.) and then storing the size and location attributes directly on the page that is using the box, but I wasn’t sure if that was proper practice.Thanks for any advice.

Link to comment
Share on other sites

If the box has to be in a different position in every single page then I don't see a problem in putting the top, left, width, and height declarations on the element itself. But you can use a class for the background color, position: absolute and other styling information.

Link to comment
Share on other sites

If the box has to be in a different position in every single page then I don't see a problem in putting the top, left, width, and height declarations on the element itself. But you can use a class for the background color, position: absolute and other styling information.
Ok then, I'll stick with that.Thanks :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...