There is a national timetable database - IDOS (switch to English down there), where you can find ALL buses, trains, trams, trolleybuses etc. that run through Ostrava, the Czech Republic and also from CZ to abroad. Both public transport and coaches at the same place. It is widely used in the Czech Republic and very reliable. Apps for mobile devices are available too.
Travelling by bus or by train within the Czech Republic is quite cheap compared to most other countries (Slovenia, Denmark, Spain etc.). The price of a ticket in CZK is about equal the amount of kilometres. Prague, for example, is about 350 km far from Ostrava and you usually pay around (or rather up to) 300 CZK, and to a village 30 km far from Ostrava you pay about 40 CZK.
Public transport in Ostrava
DPO - Ostrava Public Transport - offers time limited kinds of tickets. When you buy the ticket, do not forget to stamp it in the orange box on the bus or tram, otherwise it is not valid!
Another option is to buy a ticket through text message. It costs 30 CZK and it is valid for 70 minutes. It is just enough to write the text "DPO70" (DPO = letters, 70 = numbers) and send it to the number 902 30 (as you can read on every timetable board of tram/bus stop). Send it two minutes BEFORE getting on a tram/bus so that you get a text message with details of your ticket - you should not board the tram/bus before you receive it!
Or just tap&ride with your bank card! You can use your contactless card to buy a ticket on board.