I'm developing a webpage, and I have a CSS file for landscape and one for portrait view, but on mobile device when I start to type in a text box in portrait mode then automatically change to landscape. How can I fix this?

I know about bootstrap but that's too late for me, because I have too many pages, so I need a solution without that if it is possible.