Usually not (at least not legally) because it isn't your property to do any work on. Most of us actually own less real property than we take care of, though, because the property line is rarely actually the street or sidewalk where we stop taking care of the grounds. Some cities oblige property owners to take care of that common land which faces their property (sides of roads); some do not. It is rare that the city complains about anyone taking care of that strip of land though, for obvious reasons, and they typically do not even react when the owner of the land plants trees or shrubs or flowers or whatever in that strip.
If that is the land that you are talking about, the city might not care if your fence extends into the city right of way or lot that is used for the street, as long as it doesn't interfere with traffic or road maintenance, or drainage, in any way. Of course, if some day the city needs to dig on that part of the lot, they won't have to recompense you for destroying a fence that you erroneously placed on their land.
Short answer: you shouldn't do it, you are not really allowed to do it, but you might get away with it. It is not your land to obstruct.