Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8101777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:04:14+00:00 2026-06-05T23:04:14+00:00

I try to align an image (a logo) with a text in two lines

  • 0

I try to align an image (a logo) with a text in two lines (the title of the website and a short description).

I try to do this HTML code :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-FR" lang="fr-FR">
    <head>
        <link type="text/css" rel="stylesheet" href="style.css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body>
        <div id="site">
            <div id="header">
                <a title="Retour à l'accueil" href="#"><img width="40" height="40" title="mon logo" alt="mon logo" src="images/logo.png"/></a>
                <div class="title">
                    <h1>Mon site</h1>
                    <div>mon sous-titre avec des g et des p</div>
                </div>
                <div class="switchlanguage right">
                    <a href="#" title="english site"><strong>english</strong></a>
                </div>
                <div class="clear"></div>
            </div>
            <div id="content">
                <p>homepage</p>
            </div>
        </div>
    </body>
</html>

with this style.css :

/**********
 * RESET *
 **********/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
/*table, caption, tbody, tfoot, thead, tr, th, td,*/
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font: inherit;
    vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */

article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
html {
    overflow:auto;
    font-size: 62.5%;
}
body {
    line-height: 1;
    color: #000;/*#656565;*/
}
ol, ul {
    list-style-type: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

 /**********
 * COMMON *
 **********/
body {
    font-family:Arial;
    color:#333333;
}

.left {
    float:left;
}
.right {
    float:right;
}
.clear {
    clear:both;
    height:0;
}
#site strong {
    font-weight:700;
}
#header, #content, #footer {
    width: 990px;
    margin-left: auto;
    margin-right: auto;
    padding-left:20px;
    padding-right:20px;
}

 /**********
 * HEADER *
 **********/

 #header {
    padding-top:20px;
    padding-bottom:20px;
    background-color: #FFF;
 }

 #header img {
    float: left;
    margin:0;
    padding:0;
    border: none;
 }

 #header div.title {
    float: left;
    padding-left:20px;
 }

 #header div.title h1 {
    font-size:2.6em;
    line-height:0.904em;
    height:0.904em;
 }

 #header div.title div {
    font-size:1.8em;
    line-height:0.917em;    
    height:1em;
 }
 #header .switchlanguage {
    font-size:1.1em;
 }
 #header .switchlanguage a {
    background-image:url('images/icn_langage.png');
    background-repeat:no-repeat;
    background-position:left center;
    padding-left:20px;
    color:#333333;
    text-decoration:none;
 }
 /**********
 * CONTENT *
 **********/

 #content {
    background-image:url('images/bg_body_repeat.jpg');
    background-repeat:repeat;
    min-height:400px;
    padding-top:10px;
    padding-bottom:20px;
    border-top:1px solid #ccc;
    border-bottom:1px dotted #909090;
 }

But in IE7, the letters p and g is cropped.

You can see the result here

What is the best practice to align image and a text in two lines ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:04:16+00:00Added an answer on June 5, 2026 at 11:04 pm

    In your css here:

    #header div.title div {
        font-size: 1.8em;
        line-height: 0.917em;
        height: 1em;
    }
    

    Increase your line-height – this should fix it. The exact value will require some testing and depend on your design.

    You might also, want to wrap your text in <p> tags instead of <div> tags, as you did somewhere else in the code – just for semantics!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following html: <a href=javascript:<%# 'js code' %> class=MyClass> <div class=HeaderRow style=vertical-align:middle;text-align:left;height:35px;width:998px;>
When I try to bottom-align text in a DIV element, I face the issue
I'm try to change text color and align item in spinner to center of
I have this simple problem. I'll try to explain with a sample code An
Got this simple piece of html code and I want to make the TEST
I am trying to align an image and some text together. If you refer
I try to work out, that the two p should be besides the image
Try running this in a .VBS file MsgBox(545.14-544.94) You get a neat little answer
Try the following code: s = '#value#' puts s.gsub('#value#', Regexp.escape('*')) # => '\*' puts
What's the best way to align icons (left) and text (right) or the opposite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.