Period + Pregnancy

Is it true that you can still be pregnant even though you get your period a couple days after you've had sex? I heard you got your period because you had sex so close to your cycle starting but you could still be pregnant,