The building of Rama's bridge is described in this chapter of the Yuddha Kanda of the Ramayana, but the description is rather vague.
Here is what Varuna the ocean god tells Rama:
Therefore, I am fathomless and my nature is that it is impossible of being swum across. It becomes unnatural if I am shallow. I am telling you the following device to cross me. O, prince! Neither from desire nor ambition nor fear nor from affection, I am able to solidify my waters inhabited by alligators. O, Rama! I shall make it possible to see that you are able to cross over. I will arrange a place for the monkeys to cross me and bear with it. As far as the army crosses me, the crocodiles will not be aggressive to them.
It's unclear whether Varuna is saying that he usually never solidifies his waters for any reason, but that he's granting a special exception to Rama, or whether he's saying that he will "bear" the crossing of the Vanara army without resorting to solidifying the ocean water. Either way, what he seems to be saying is that he will bear the weight of the bridge, rather than allowing it to sink to the bottom of the ocean.
This is confirmed when he tells Rama to have the Vanara Nala build the bridge:
O, excellent man! This one, named Nala, a glorious person, is the son of Vishvakarma; who was given a boon by his father and is equal to Visvakarma. Let this greatly energetic monkey build a bridge across me. I can hold that bridge. He is just the same as his father.
In any case, here is the actual description of the bridge:
From here and there the monkeys brought Palmyra trees, pomegranate shrubs, coconut and Vibhitaka, Karira, Bakula and neem trees. The huge bodied monkeys with mighty strength uprooted elephant-sized rocks and mountains and transported them by mechanical contrivances. The water, raised up due to sudden throwing of mountains in the sea, soured upward towards the sky and from there again, gushed back. The rocks befalling on all sides perturbed the ocean. Some others drew up strings a hundred Yojanas long (in order to keep the rocks in a straight line.) Nala on his part initiated a monumental bridge in the middle of the ocean. The bridge was built at that time with the cooperation of other monkeys, of terrible doings. Some monkeys were holding poles for measuring the bridge and some others collected the material. Reeds and logs resembling clouds and mountains, brought by hundreds of monkeys, lead by the command of Rama, fastened some parts of the bridge.
Monkeys constructed the bridge with trees having blossom at the end of their boughs. Some monkeys looking like demons seized rocks resembling mountains and peaks of mountains and appeared running hither and thither. Then, a tumultuous sound occurred when the rocks were thrown into the sea and when mountains were caused to fall there. On the first day, fourteen Yojanas of bridge were constructed by the monkeys speedily, thrilled with delight as they were, resembling elephants. In the same manner, on the second day twenty Yojanas of bridge were constructed speedily by the monkeys of terrific bodies and of mighty strength.
The passage isn't explicit about the role of the trees, but the part I put in bold provides some indication; it says that the logs "fastened some parts of the bridge". That suggests to me that the trees served to maintain the distance between the boulders and transplanted mountains that formed the core of the bridge. I don't think the trees were what held the rocks up; there would have been no need for that, because Varuna promised to hold the bridge up himself.
Of course, this is all just speculation on my part. Tulasidas' Ramcharitmanas provide more detail about Nila and Nala getting a curse that would make anything they throw into the water float, but such specificity isn't there in the original Ramayan's account of the building of the bridge.