Yeah you can.
But Steam doesn't want it, according to a support rep:
Unfortunately, Steam accounts and games are non-transferable. Steam Support can’t provide someone else with access to the account or merge its contents with another account. I regret to inform you that your Steam account cannot be transferred via a will.
This means you can leave your login details in your will, but Steam can block the account. Also, in case the login details in your will are not correct anymore or no login details were shared, Steam will not give access.