Nothing is "written off." The sale of the home has nothing to do with your itemized deductions on schedule A or using the standard deduction.
Start by reviewing publication 523.
1. Your gain is the difference between your selling price and your adjusted cost basis. Your cost basis is what you originally paid, plus and minus adjustments. Adjustments to the cost basis are listed in publication 523, they include permanent improvements (but not repairs), as well as certain of your closing costs from the purchase. You may have to reduce the home's cost basis if you used it for business or as a rental. You can also subtract the real estate commission from the selling price and possibly some of your closing costs, as listed in publication 523.
2. Your gain or loss is reported on a schedule D (if you need to report the gain). Any gain is taxed there. It doesn't have anything to do with itemizing your personal deduction (mortgage, property tax, etc.)
3. Property tax you paid, and mortgage interest you pay, is certainly deductible on schedule A, but if you are married filing jointly, your deductible expenses may be less than the standard deduction.
4. If you owned the home and lived in it as your main home for less than 2 years, you may still be able to use a partial capital gains exclusion if you are selling for one of certain listed "unforeseen circumstances". See page 6 of publication 523. Giving birth to a single child is not one of the listed circumstances that is automatically accepted by the IRS, but there is a general category for "other facts and circumstances." If you believe you can show that the birth of your child caused a significant financial hardship (considering your particular unique facts and circumstances) then you can claim a partial exclusion. The exclusion is time-based, and is based on whichever is shorter--the length of time you owned the home, the time you lived in the home, and the time since you last sold a home. For example, if you will have owned the home 600 days before you sell it, but you lived in it only 580 days, then your exclusion would be 580/730 x $500,000 = $397,000. (This assumes you are married filing jointly and two years equals 730 days.)
If you claim the partial exclusion, you don't send proof to the IRS with your tax return, but keep your proof for 6 years in case of audit.
you may want to consult with a tax pro. in certain situations a partial exclusion is available even when either or both 2 out of 5-year tests are not met
1) change in place of employment
3) unforeseen circumstances
4) facts and circumstances (reg 1.121-3(b) as follows
Primary reason for sale or exchange. In order for a taxpayer to claim a reduced maximum exclusion under section 121(c), the sale or exchange must be by reason of a change in place of employment, health, or unforeseen circumstances. If a safe harbor described in this section applies, a sale or exchange is deemed to be by reason of a change in place of employment, health, or unforeseen circumstances. If a safe harbor described in this section does not apply, a sale or exchange is by reason of a change in place of employment, health, or unforeseen circumstances only if the primary reason for the sale or exchange is a change in place of employment (within the meaning of paragraph (c) of this section), health (within the meaning of paragraph (d) of this section), or unforeseen circumstances (within the meaning of paragraph (e) of this section). Whether the requirements of this section are satisfied depends upon all the facts and circumstances. Factors that may be relevant in determining the taxpayer's primary reason for the sale or exchange include (but are not limited to) the extent to which -
(1) The sale or exchange and the circumstances giving rise to the sale or exchange are proximate in time;
(2) The suitability of the property as the taxpayer's principal residence materially changes;
(3) The taxpayer's financial ability to maintain the property is materially impaired;
(4) The taxpayer uses the property as the taxpayer's residence during the period of the taxpayer's ownership of the property;
(5) The circumstances giving rise to the sale or exchange are not reasonably foreseeable when the taxpayer begins using the property as the taxpayer's principal residence; and
(6) The circumstances giving rise to the sale or exchange occur during the period of the taxpayer's ownership and use of the property as the taxpayer's principal residence.