I styled some elements that I added to the header. I noticed that when I reduce the size of the browser window to mobile phone size and the website switches to mobile phone menus, my styling goes away.
It looks like the website theme is switching to the following style sheet when it goes mobile:
/wp-content/themes/vantage/premium/extras/mobilenav/css/mobilenav.css
Is that correct?
Is there a way to create a child theme css style sheet for “mobilenav.css” so I can maintain the styling of the elements I added to the header even when the site switches to mobile styling?
Thanks.
Website Login Credentials:
Username: demo
Password: demo01
I think I found the answer to my second question about creating a child css style sheet. I believe I need to use the wp_enqueue_style function. I found a video course on it at Lynda.com:
If you know of a simpler way, please let me know.
I still need to know if
is the correct style sheet to make mine dependent on?
Do you happend to know what the handle for it is?
Thank you.
Hi MeOnWrdPrs
You’re definitely on the right track here. If you just need to style the mobile menu you can use a set of selectors under Appearance > Custom CSS OR in the style.css of your child theme.
Here we go:
Hope that helps.
Thank you for the CSS code to the mobile navigation menu. It may be helpful in the future.
I have been thinking about my problem since your last post, and realized that the CSS code in my child theme CSS style sheet is working up to the point of reaching my 680 max-width media query. So, I think if I can get the right selectors placed in the child theme style sheet, I will be done, rather than programming more php. (I now know that importing the master style sheet from the Vantage Theme, into the child theme, is not the preferred method, but I need to get done relatively soon and importing works)
I believe that I don’t have the right selectors in the child theme media query for max-width of 680px. I say that because I can change the properties of the target elements from the Google Chrome Developer Tool, but when I copy and paste the selectors from the Developer Tool to my child theme CSS, they have no effect. I must not have enough specificity, but I cannot tell from the Developer Tool what selectors I am missing. Everything looks like it should work. I hope this makes sense.
I have pasted the relevant portion of the CSS from my child theme style sheet. Can you tell if I am missing anything in my selectors that I may not see in the Chrome Developer Tool?
Thank you.
::::::::::::::::::::::::::::::::::::::::::::::::::::::Below is the CSS code from my style sheet:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Glad to hear you’ve been making some progress. Could we perhaps approach things in the following manner…what else needs to happen in the header below 680px right now? What needs to change? Let me know that and I’ll help out.
(I’m pretty sure your breakpoint needs a metric, in this case px needs to follow 680)
I created a video clip of what is currently happening as I click and drag the right side of the browser window to the left while reducing the viewport size. The video should demonstrate the problem. I also provided a PNG file, diagraming what I would like to see happen. The URLs to the files are listed below:
URL to Video –> http://www.screencast.com/t/h2OAa9Lpm
URL to PNG –> http://www.screencast.com/t/h2OAa9Lpm
(Even though the URLs look identical, they seem to be file specific. I don’t know how.)
Please let me know if you need any clarification. Thank you.
The PNG is unfortuntatley not there on my side so I might have to see that. Try the following to keep the button style active below 680:
I’m sorry you couldn’t see the PNG file. Try these links. Hopefully one of them will work. I will test them. Apparently, Screencast.com was acting strangely yesterday.
You should see a diagram of what I am trying to accomplish.
PNG file —> http://www.screencast.com/t/GhsjDG4ikp
GIF file —> http://www.screencast.com/t/lyxQSccnz
BMP file —> http://www.screencast.com/t/iGKbIAqNjD1
JPG file —> http://www.screencast.com/t/M0CQKnfbQ3
I tried the CSS you provided. It hasn’t worked yet, but I think something must be blocking it. The browser acts like it is ignoring the 680 px media query altogether. I have to find a way to confirm that suspicion. I’m looking for ways to isolate CSS quickly so I can figure out what is going on.
Thank you.
I have confirmed that the 680 px media query is being ignored by the browser. I don’t know why, but I am going to figure it out. I must have done something incorrect.
Thanks.
The CSS I sent through wouldn’t have shifted everything on tablet, just sorted out the button formatting and placement on mobile view. Is the Custom CSS in place right now?
The header sidebar area is definitely sensitive on mobile when several widgets are added. This is something we can work on in the future. For now it might might be easiest to consider a banner there or just some solution that doesn’t require re-formatting breakpoints.
I have very good news. I’m done. Everything is working the way I wanted it to. Thank you for your help and suggestions. There was a typo in the media query statement for the mobile devices. That is why the media query was being ignored by the browser. URGH!!!! After that, it was just a matter of using the right styles and rethinking the media queries. I used a lot of percentages. Thanks again for your help Andrew. You can stop reading here. The rest is for the benefit of others.
For anyone else reading this thread:
Below are very basic instructions for anyone else reading this forum thread and trying to put something in the header between the logo and the “Header Text” and make it responsive. Warning: You will need to understand HTML, CSS, and Media Queries to make it work. I did things this way because I had trouble getting header widgets to cooperate. This isn’t a tutorial. I’m just going to provide the code I used. Hopefully, you can look at it and glean some ideas. Most of the style sheet is for the rest of the website. The media queries toward the bottom of the style sheet are the most important parts to look at.
First, within the WordPress Administration area, I clicked on Appearance –> Theme Settings –> Header Text field
Second, I pasted the following HTML into the Header Text field:
Third, I had already created a child theme for the Premium Vantage Theme with the file name, “style.css”. If you don’t have one yet, you will need one. I imported the Vantage theme into the child theme style sheet. I know that isn’t what WordPress recommends, but I was in a hurry and it worked. :)
(Note: I purchased the Premium Vantage Theme. This solution probably won’t work without it.)
Fourth, I put the following styles in my child theme style sheet and that is it:
I hope someone finds this helpful.
That’s awesome, really glad to hear you were able to troubleshoot your way through this. Thanks for sharing your results!