It's not as straight forward as that, unfortunately.
Bridges are analyzed for certain load configurations. For most highway bridges, this is the HL-93 load or for older bridges, sometimes an HS-20 load. These are theoretical truck loads which capture the load effects of most vehicles on the road today.
If a bridge is deemed unable to carry the design load with a certain safety factor, the calculations are re-run with a few more specific trucks. By trucks, I really just mean sets of axle loads at certain spacings. These specific vehicles vary from state to state, and are collectively called the "posting loads". If the bridge is not sufficient for all these specific trucks, the bridge gets "posted" with a sign. This is the rating you are referring to.
The "XX tons" rating then is related to a specific legal load configuration (there's often a little truck symbol on the sign). For example, an HS-20 design truck theoretically weighs 36 tons. If a bridge is unable to handle a full HS-20 truck load with the safety factor we want, the bridge might get posted for a 20 ton "HS-20" truck. If your truck is geometrically similar to an HS-20 configuration, and only weighs 18 tons total, you're good to go. If your truck looks more like an "Type 3" truck, you'll need to find out what the rating is for that configuration.
This presentation might also help if you're a visual person: