will a graphics card work on my desktop (HP Pavilion p7-1127c)

Solution
One thing to watch out is space. Even though I'm sure you have the proper slot... for some reason HP computers use motherboards that aren't "Gamer Friendly". An HP computer I once owned used a motherboard that had the 24 pin motherboard socket positioned right where the end of a graphics card would touch... so I couldn't fully insert a card into the board. However, I did resolve the issue by using a Riser Card which lifted the GPU about 1/2" up...

Before you buy a card... take a look inside your case and see if there is anything there that would block a regular sized card... or take a photo and post it here then everyone would be able to tell how much space you would have.

An alternative would be to look for a low profile card...
Yes it can take a graphics card as it has the required PCIe x16 slot. The only issue is the 300W PSU, you can't put a power hungry card in without replacing your PSU. I don't know what graphics card you had in mind, but your CPU could handle a mid range card, something like the GTX 750 and your PSU should be fine with it.
 

SBMfromLA

Distinguished
One thing to watch out is space. Even though I'm sure you have the proper slot... for some reason HP computers use motherboards that aren't "Gamer Friendly". An HP computer I once owned used a motherboard that had the 24 pin motherboard socket positioned right where the end of a graphics card would touch... so I couldn't fully insert a card into the board. However, I did resolve the issue by using a Riser Card which lifted the GPU about 1/2" up...

Before you buy a card... take a look inside your case and see if there is anything there that would block a regular sized card... or take a photo and post it here then everyone would be able to tell how much space you would have.

An alternative would be to look for a low profile card.. those would surely fit into tight spaces.
 
Solution