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 6736997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:11:47+00:00 2026-05-26T11:11:47+00:00

I have this code : HTML <div class="temperatura"> <a href="/link/" class="temperatura_localita"> <div style="padding-left:12px;"> Text1

  • 0

I have this code :

HTML

<div class="temperatura">
    <a href="/link/" class="temperatura_localita">
        <div style="padding-left:12px;">
            Text1
        </div>
    </a>
    
    <a href="/link/" class="temperatura_dettagli">
        <div style="padding-right:70px;">            
            Text2
        </div>
    </a>        
</div>

CSS

.temperatura
{
    height:34px;
    position:relative;
    background-color:#FF0000;
    font-size:14px;
    font-weight:bold;
}

.temperatura_localita
{
    width:50%;
    height:34px;
    line-height:34px;
    float:left;
    text-decoration:none;
}

.temperatura_dettagli
{
    width:50%;
    height:34px;
    line-height:34px;
    float:left;
    text-align:right;
    text-decoration:none;
}

I need two linkable element (50% each) with a padding left(first) and right(the second).

The only strategy I know is to make two a (floatted) with internal divs with padding.

But it is "incorrect". So how can I do this?

EDIT

The other solution is just change the internal div (the ones with padding) with span : http://jsfiddle.net/p8Mps/3/

But try to enlarge/decrease the window on IE7 : it will fails…

  • 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-05-26T11:11:47+00:00Added an answer on May 26, 2026 at 11:11 am

    <a> (anchors) are inline elements.

    <div> (divisions) are block level elements.

    HTML 4.01 specifications state that <a> elements may only contain inline elements. A <div> is a block level element, so it must not appear inside an <a>.

    Never put block level elements inside inline elements.

    You would put inline elements inside block level elements instead…

    <div class="temperatura">
        <div style="padding-left:12px;">
            <a href="/link/" class="temperatura_localita">
                Text1
           </a>
        </div>
        <div style="padding-right:70px;">
            <a href="/link/" class="temperatura_dettagli">      
                Text2
            </a> 
        </div>       
    </div>
    

    EDIT based on OP’s comments…

    http://jsfiddle.net/sparky672/p8Mps/9/

    <div class="temperatura">
        <div class="temperatura_localita">
            <a href="/link/" style="margin-left:12px;">
                Text1
           </a>
        </div>
        <div class="temperatura_dettagli">
            <a href="/link/" style="margin-right:70px;">      
                Text2
            </a> 
        </div>       
    </div>
    

    EDIT 2 based on further comments…

    http://jsfiddle.net/sparky672/p8Mps/13/

    <div class="temperatura">
        <a href="/link1/" class="temperatura_localita">
            <span>Text1</span>
        </a>
    
        <a href="/link2/" class="temperatura_dettagli"> 
            <span>Text2</span>
        </a>   
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code : HTML (meaning 4.0) <div class="temperatura"> <a href="/link/" class="temperatura_localita"> <span
I have this HTML code: <div id=content> <div class=profile_photo> <img style=float:left;margin-right:7px; src=http://gravatar.com/avatar/53566ac91a169b353a78b329bdd35c95?s=50&d=identicon class=profile_img alt={username}/>
Hi I have this HTML code <th scope=col class= style=width: 13px;> <div class=some-handle></div> <a
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>
I have HTML code like this : <div> <a>Link A1</a> <a>Link A2</a> <a>Link A3</a>
Say I have jquery code like this: html += '<div class=index>' + item.index +
i have this code in my index.html: <div id=users-list> <tr class=<%= cycle('odd', 'even') %>
I have this content: <div class=CodeRay> <div class=code><pre>puts <span style=background-color:#fff0f0;color:#D20><span style=color:#710>&quot;</span><span style=>Hello, world!</span><span style=color:#710>&quot;</span></span></pre></div>
I have this html code: <body> <div class=CodeRay> <div class=code><pre><span class=no> 1</span> require <span
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div

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.