Search code examples
htmlcssflexbox

displaying two name underneath each other after the logo


I want to display a logo and right next to the logo, I want to display the name of the parent company and then the name of my company right underneath the parent company in a HTML page. when I browse the HTML page, I see the name of the parent company, but I don't see the name of my company. I have the following code:

<body>
    <div>
        <span style="display:flex;">
            <a href="https://www.apple.com/">
                <img src="Images/apple.png" alt="RCA" width="80" height="80" class="d-inline-block align-middle mr-2" runat="server" />
            </a>
            <span style="font-size:25px;color:white;"><span style="color:#e9c46a">This is parent Company</span><br />This is my company name</span>
        </span>
    </div>
</body>

I dont see "This is my company name" right underneath the parent company. I want both "This is parent Company" and "This is my company name" aligned in the middle right underneath each other. Right now, when I run the code, I see this:

enter image description here

I want something like this:

logo This is parent Company
     This is my company name

any help will be appreciated.


Solution

  • This is one way to do it:

    <html>
    <head>
        <title>Test</title>
        <style>
            .container {
                display: flex;
                align-items: center;
                padding: 10px;
            }
            
            .logo {
                width: 100px;
                height: 100px;
                margin-right: 20px;
            }
            
            .names {
                display: flex;
                flex-direction: column;
            }
            
            .name {
                font-size: 24px;
                margin-bottom: 10px;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="logo">
                <img src="https://via.placeholder.com/100" alt="Logo">
            </div>
            <div class="names">
                <div class="name">Parent Company</div>
                <div class="name">My Company</div>
            </div>
        </div>
    </body>
    </html>

    Just add your logo and make any necessary adjustments.