Speaking from my own experience...
There is no one answer to the question of "how is this UI interface element drawn".
Under windows you can get them as freebies where the OS gives you a helping hand but windows tends to be very inflexible with its ready made UI element and tends to boil down to "styles". But windows also provides its own graphics environment which is powerful enough that the text CGP&P uses it to introduce graphics programming.
Linux is similar but with its own strange and wonderful quirks. But without the manufacturer provided graphics environment.
Beyond that, browser designers are on their own and can use a variety of techniques, here are some:
Bitmap graphics: This is a bit old in terms of windows... but you can just save your own "bitmaps" rendered however you like, then load them up and blast them to the screen just like any other texture map. But the usual caveats apply.
Just draw them on the fly: Basically create functions that have all the details of drawing the UI the way the project demands. Then when a UI element is needed the function provides the details on drawing the element. This approach can be kept simple or you can go crazy and end up with a vast and complex interface that only the designer understands.
Many graphics environments provide some sort of help with all this, but it sounds like you are writing that environment.
There are some new techniques that are emerging, the slug library (which is a font rendering algorithm but can be used to draw many other UI elements) allow "glyphs" to be drawn. Using glyphs you can draw beautifully rounded and even complex corners that render surprisingly fast, scale almost perfectly, look great from any angle, the list goes on. But the algorithm behind slug is patented so you have to pay for the privilege.
For a simple rounded edge that looks good as a 2d element you can draw a circle at each corner, then connect the corners with straight lines. For a "shadow" draw 2 circles slightly offset from one another, draw the shadow circle slightly darker. Then draw a rectangle inside the entire works, and then the text or whatever is needed inside the rectangle. I know this sounds simplistic, but if done well it can look really nice, is straight forward to implement and performant. Be sure to draw the UI first and use depth buffering to help with whatever is drawn behind the UI.