Container width fits his children width
===

maybe this is a silly question, but I can't solve on my own.
I have a container (a div) which contains some other elements (example paragraphs, images and so on).
I want to assign a value to the container's width in order to center it in the page. (the default behaviour makes the container's width 100%, so I can't center it)
I have found a lot of posts talking about how to make the child element's width fit the container's one, but the only way I know to do the reverse is by using javascript (I want to avoid this).

Is there any way to do this by css?

Thanks in advance!