How can I fit a Datatable only into a webpart (not page) dynamically?

I develop a Webpart, which should be deployed in other SP-Farms.
The Webpart contains a DataTable.
I deployed the solution and the DataTable appears in the right side of the Website.
I’m using a gridView and have some style-components like margin-right: 50px.

I understand that the Table appears in the right side of the Website, but is there a opportunity to get the Table only into the Webpart?

at the momemt

should be

I use a GridView and want to do the css here with the cssstylecollection. but it doesnt really work?

cssstylecollection