mohamedddo :
OK my friend i will buy i5-8400 but can it work good with H310M Motherboard ?
Yes, as long as you don't mind the limited connectivity and expandability options as Rogue pointed out.
I put a H77M motherboard in my PC thinking I'm unlikely to use PCIe slots beyond GPU. Five years later, I wished I had spent the extra $10 to get an ATX-size motherboard so I wouldn't have to pick between my 1394a card and my USB3 card for extra USB3 ports. An extra fan header or two wouldn't have hurt either.