NMcMurray Posted October 7 Posted October 7 (edited) Site URL: https://www.theauctionrooms.co.uk/ I currently have some custom code in place to create the attached header menu. The "book a day pass" and "book a meeting room" text are set up as links that need to look like buttons. The "book a day pass" is new, and I can't figure out how to make it look the same and aligned to the right of the page, as well as appearing within the mobile menu. Can anyone help? Edited October 7 by NMcMurray
Solution Mahmoud Posted October 7 Solution Posted October 7 (edited) Hi, The current custom code applied to create a header menu button is not scalable. You need to deactivate that CSS code first by commenting it out and then paste my following CSS code: .header-nav-list div:not(:last-child):has(a[target='_blank']) { position: absolute; right: 14rem; } .header-nav-list div:last-child:has(a[target='_blank']) { position: absolute; right: 0; } .header-nav-list a[target='_blank'], .header-menu-nav-wrapper a[target='_blank'] { display: inline-block; background-color: #586f79; padding: 10px 20px; border-radius: 50px; } @media only screen and (max-width: 1250px) { .header-nav-list .header-nav-item:has(+ div:not(:last-child) a[target='_blank']) { margin-right: auto; } } I used a bit more advanced CSS selectors to write fewer lines of code, to make it scalable and work on mobile view too. N.B.: At a viewport width of 1250px, the elements will overlap. To prevent this, I aligned the navbar links to the left as per the attached. Also, the above code only works on header buttons that will open a new tab when clicked. Remember to comment out the current custom CSS codes for the header menu button first before applying my codes. Hope this helps! Mahmoud Edited October 7 by Mahmoud
NMcMurray Posted October 8 Author Posted October 8 Hi Mahmoud, thank you so much for sending across a solution! It works perfectly and resolves the issues with scalability. Many thanks Nicola
Mahmoud Posted October 9 Posted October 9 Hey @NMcMurray, You're welcome! Please mark the topic as solved so it helps everyone who encounters the same issue. Thank you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment