Creating a vertical menu from a horizontal navbar can be achieved by adjusting the CSS properties of the glyphs

I am looking to display the symbols like in scenario A for desktop screens and as in scenario B for mobile devices when the menu is expanded. (The code is identical in both scenarios, with the exception of the CSS).

Scenario A: http://jsfiddle.net/bs773m84/4/

<div class="container">
    <nav class="header-nav-wrapper container-nav-menu navbar navbar-default white-back">
        <div class="container-fluid">
            <div class="navbar-header">                       
                <a alt="" rel="home" href="google.com">
                    <img class="logo" src="http://icons.iconarchive.com/icons/cornmanthe3rd/plex-android/48/app-drawer-icon.png"/>
                </a>
                <button data-target="#social-menu" data-toggle="collapse" class="navbar-toggle collapsed" type="button">
                    <span class="sr-only"><?php _e('Toggle navigation menu','justmakeit');?></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>
            <div class="col-sm-11 content">
                <div class="container-fluid">
                    <div class="hidden-xs col-sm-6   blue-light-back"><span>Brand</span>
                    </div>
                    <div class="col-xs-12 col-sm-4 col-sm-push-4 col-md-push-4 red-dark-back">

                        <div id="social-menu" class="collapse navbar-collapse">
                            <ul class="menu nav navbar-nav navbar-default white-back">
                                <li class="facebook">
                                    <a  href="http://facebook.com" target="_blank">
                                        <span class="glyphicon glyphicon-play-circle"></span><span class="social-name">facebook</span>
                                    </a>
                                </li>
                                <li class="twitter">
                                    <a href="http://twitter.com" target="_blank">
                                        <span class="glyphicon glyphicon-download"></span><span class="social-name">twitter</span>
                                    </a>
                                </li>
                                <li class="google-plus">
                                    <a  href="http://plus.google.com" target="_blank">
                                        <span class="glyphicon glyphicon-download"></span><span class="social-name">google+</span>
                                    </a>
                                </li>
                                <li class="pinterest">
                                    <a href="http://pinterest.com" target="_blank">
                                        <span class="glyphicon glyphicon-download"></span><span class="social-name">pinterest</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>

            </div>
        </div>
    </nav>
</div>

Scenario A's CSS:

#social-menu li{
    display: inline-block;
    padding: 0px;
}
#social-menu li a{
    padding: 0px;
}

#social-menu .social-name{
    display: block;
    height: 1.4375em;
    overflow: hidden;
    text-indent: 100%;
    transition: all 0.3s ease 0s;
    white-space: nowrap;
    width: 1.4375em;
}

Scenario B: http://jsfiddle.net/77m94xf4/4/

The HTML remains the same as in Scenario A. Scenario B CSS: None.

Answer №1

If you want to customize your CSS attributes for different screen sizes, you can utilize the @media Query in your code. Here's an example:

@media screen and (max-width: 300px)
{
    /* Add your CSS for mobile */
}

@media screen and (min-width: 800px)
{
    /* Add your CSS for desktop */
}

Using @media Query allows you to effectively set custom styles for various devices such as mobile phones, tablets, and desktops.

Explore more about @media query here

Answer №2

I implemented a mobile-responsive solution by using @media queries to adjust the CSS of the menu items.

@media screen and (min-width: 1px) and (max-width: 767px){
    #social-menu li{
        display:block
    }
    #social-menu .social-name{
        display: inline;
        height: none;
        overflow: none;
        text-indent: none;
        white-space: none;
        width: none;
    }    
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Fixing the Overflow Property in CSS

I just started learning about css, and I've encountered a problem with the code for the overflow property: div.hidden { background-color: #00FF00; width: 1000px; height: 1000px; overflow: hide; } ...

Issues with the Bootstrap Grid System not functioning correctly when inter-component communication is needed in Angular from parent to

This is the code from app.component.html file: <div class="container"> <div class="row" id="ads"> <div class="col-xs-4"> <app-card *ngFor="let car of cars" [carNotifyBadge]="car.carNotifyBadge" [ca ...

CSS swapping versus CSS altering

Looking to make changes to the CSS of a page, there are two methods that come to mind: Option 1: Utilize the Jquery .css function to modify every tag in the HTML. For instance: $("body").css("background : red") Alternatively, you can disable the current ...

Transitioning between pages causes a delay in loading the background

Today as I was working on my CSS, I encountered some issues. I utilized Bootstrap and Darkstrap for designing. In Darkstrap, the style for the body is body { color: #c6c6c6; background-color: #2f2f2f; } Meanwhile, in my own CSS: body { ...

"Enhance Your Design With CSS3 Styling for Labels and

HTML <div class="select"> <div> <label for="kitty" class="kitty-label kitty-label-1 l-center"> </label> <input type="checkbox" name="cats" value="1"> <label>Kitty One</label> ...

Enhancing Checkbox Styles with Foundation 6 CSS

Exploring the creation of custom CSS Checkboxes using existing CSS code. .nk-btn-color-dark-5 { background-color: #293139; border-color: #101215; border-style: solid; } .nk-btn-color-dark-5:hover, .nk-btn-color-dark-5.hover { background-color: # ...

CSS table row border displaying irregularly in Chrome and Internet Explorer

I recently created a basic table with bottom row borders. Surprisingly, the borders display perfectly in Firefox but only partially in Chrome and IE 10: <div style="display:table; border-collapse: collapse; width: 100%"> <div style="display:table ...

Incomplete Website Encryption Alert

Currently, I am developing a website called "usborroe.com" and have just set up a GeoTrust Business ID SSL Certificate. However, despite my efforts to ensure full encryption on the site, an error message is indicating that it is not fully encrypted and t ...

Getting rid of the hover box feature in a WordPress theme

Having some difficulty removing the hover effect on the WordPress theme I'm using, called Enigma. The hover effect creates a whitebox over the link, and despite trying various methods to remove it, the issue persists. You can view the website at the ...

Having trouble implementing font css file in Reactjs

When working with Reactjs (Nextjs), every time I try to incorporate "css" into my project, I encounter the following error on my screen: Module not found: Can't resolve '../fonts/fontawesome-webfont.eot?v=4.7.0' How can I solve this issue? ...

Is it possible to use a full-width material-ui Button inside a Badge component?

Within a grid, I had initially used fullWidth on a Button to make it expand and fill the container. Everything was functioning correctly until I enclosed the Button in a Badge element. Now, the fullWidth property is not being applied, and the button rever ...

Achieving the desired results through the utilization of CSS3 rather than relying on images

I am currently exploring the use of CSS3 to create a menu instead of relying on images over at . You can view my progress and code (including images and styles) here: Although I attempted to use CSS3 for the border shadow and matching the background of ...

Guidelines for centering 2 images with JavaScript

I am faced with a unique challenge involving 2 images, where one image has a designated Mask area and the other image is supposed to be visible through the Masked area of the first image. My goal is to align the second image in the center of the Mask area ...

What is the best way to increase the size of the input field to allow for more typing space?

My query is quite simple. Even when I set the height to 100px, the cursor still starts in the middle of the input box. I want the entire box to be utilized with the cursor starting at the top left corner for a more intuitive paragraph writing experience. ...

React component failing to display CSS transitions

The task at hand requires the component to meet the following criteria: Items in a list should be displayed one at a time. There should be two buttons, Prev and Next, to reveal the previous or next item in the list. Clicking the Back/Next button should tr ...

Background: Cover causing image to be cut off

I'm having trouble trying to display the top part of a background image under my current navigation bar. I've been unable to identify what mistake I may be making here. Here is my HTML code: <section class="jumbotron"> <div class=" ...

Starting a div programmatically and then running into trouble when trying to close it, an error was encountered with an end tag for "div" without a corresponding start tag

I am looking to create the following HTML structure: <div id="my-grid" class="isotope"> <div class="myProject-item">....</div> <div class="myProject-item">....</div> <div class="myProject-item">....</div> ...

Struggling to generate a div using my JS/jQuery code

Currently working on a post-it web application to improve my skills in JavaScript and jQuery. I've encountered a few errors that have me stumped. Although I'm new to StackOverflow, I often use it as a helpful resource. You can find the code here ...

Having trouble with less.modifyVars not functioning properly in Visual Studio?

I attempted to dynamically change the LESS variable using HTML within an AngularJS function. The code worked fine on XAMPP with simple HTML and CSS, but when I transferred it to an enterprise app in Visual Studio, it stopped functioning properly. While the ...

What is the best way to stretch my background image to cover the entire screen?

I am working on a Python Django project and I want to create a full-screen background. The HTML code: { % load static %} <!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags--> <meta charset=" ...