This is a question asked pretty often, especially when we consider the fact that the distance between the nucleus and the electrons is very small.
Now, let us take a simple case of a hydrogen atom, which has one proton in the nucleus and one electron. The electron is negatively charged with a charge equal to 1.6 * 10^-19 C. The proton is positively charged with a charge of 1.6* 10^-19 C.
The mass of an electron on the other hand is approximately 9.11*10^-31 kg and that of a proton is 1.673*10^-27 kg.
If the two particles are separated by a distance r, the force of attraction due to the electrical charges is k*Cp*Ce/ r^2, where k is a constant equal to 9.0*10^9 N*m^2/C^2
The gravitational force of attraction is G*Me*Mp/r^2, where G is the gravitational constant equal to 6.673*10^-11.
If we find the ratio of the electrostatic force to the gravitational force between the particles it is equal to:
[(1.6*10^-19) ^2* 9.0*10^9] / [9.11*10^-31*1.673*10^-27*6.673*10^-11]
= 2.26* 10^39
So the electrostatic force is 2.26 * 10^39 times larger than the gravitational force of attraction.
Therefore it is evident that the gravitational force is negligible compared to the electrostatic force.