Can I use h.264 codec inside .mp4 container for my website
Use it. Nothing else can provide the the same quality per bitrate as x264 (the top-class H.264 encoder) while not taking 10,000 years to encode (x265 'n VP9).

Some tips:


Use a recent ffmpeg build since development is so active. Static builds are available and easy.
Add -movflags +faststart to your command. Once encoding is finished this option will relocate the moov atom to the beginning of the file allowing playback to begin for your viewer before the file is completely downloaded.
Because ffmpeg attempts to avoid chroma subsampling using -pix_fmt yuv420p is recommended to ensure a widely compatible pixel format.
Some devices may require you to use a more restrictive profile and level. You can do this with the -profile:v and -level options. Be aware of attempting to force a specific level on outputs that will not conform (such as trying to force -level 3 on a 1920x1080 video). ffmpeg will give level limit warnings in the console output if this is the case.
See the H.264 and AAC encoding guides for more info.