I am in the process of developing an HTML5/Javascript game that will be compatible with modern browsers. The game will feature dialog boxes, or modal popups, which will have borders made up of images such as vertical, horizontal, and corner pieces. These popups, along with their borders, should adjust to contain and size to a div element containing text or other content. There will be various popup sizes needed in the game, so I am looking for a solution that allows me to use repeatable border images instead of creating individual images for each popup size.
My requirements may not be crystal clear — can these needs be fulfilled using CSS alone? Are there existing CSS libraries available that could help achieve this goal? Alternatively, is it necessary to incorporate Javascript (or a combination of both CSS and Javascript)? If so, are there any specific examples or libraries that would be helpful in accomplishing this task?