
To make floating text, cheats will have to be enabled, you must be on creative mode, and you must have highest level permissions.
The first thing you want to do is to summon an NPC at the location you want the floating text to be. Summon an NPC at the location you want the text to be by standing at the location you want the text to be and running the following command in your Minecraft chat:
/summon npc ~~~

Then, rename the NPC to the text you want to be floating. To do this, right click on the NPC and type in the name you want on the bar on the top.

Now, dig a 1 block deep hole so the NPC can fall into the hole.

Stand in each of the hole blocks you created and run this command:
/setblock ~~~ grass_block
This should make half of the NPC visible on land. It should look something like this:

After that, place down a Command Block. You can obtain a command block by running this command:
/give @p command_block
Place down the command block you just obtained, near the NPC.
Then we have to give the NPC a unique tag so only this NPC can become invisible and none other NPC’s.
To do this, stand right on top of the NPC and run this command:
/tag @e[type=npc,r=1] add !
This sets a tag called “!” to your NPC.
Make sure none other NPC’s are within 1 block or they will also be tagged.

Right-click into the command block. Turn the settings on the left:
REPEAT
UNCONDITIONAL
ALWAYS ACTIVE

Click the + arrow next to the command input box.

Inside of the new large screen, paste the following command:
/playanimation @e[tag=!] animation.creeper.swelling I 99

Once you’re done, exit the command block by clicking “esc” on your keyboard or by clicking the – button in the corner and the X to get out of the command block.
Congratulations, your text is now floating!

Feel free to rename the NPC anything you’d like.

Thanks for reading and see you again next time!