Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
497 views
in Technique[技术] by (71.8m points)

html - Expand an <a> tag to fill the space

How can I make the anchor tag expand to the bottom of the list item? I know I could put the anchor round the list item tag, but that breaks XHTML 1.0 Strict compliance, so I cannot do it.

<html>
  <head>
    <style>
      #listWrapper { text-align:center;}
      #list { margin-left: 0px auto; margin-right: 0px auto; width: 100%; min-height: 100%; height:100%; margin-bottom: 10px; margin-top: 0px;}
      #list ul { padding: 5px 10px 10px 10px; margin: 0; min-height: 100%;}
      #list li { clear:both; font-weight:bolder; height:auto; border-bottom: 1px solid Silver; border-left: 1px solid Silver; font-size:x-small; border-right: 1px solid Silver; list-style-type: none;}
      #list a:hover { background-color: red;}
      #list a { display:block; cursor:pointer; text-decoration: none; text-align:left; vertical-align:top; }
      #list h3 { background-color:Silver; vertical-align:top; font-size:larger; }
      #list img { height:auto; margin: 8px; float:left; vertical-align:top; border:solid 1px Silver;}   
    </style>
  </head>
  <body>
    <div id="listWrapper">
      <div id="list">
        <ul>
          <li>
            <h3>title</h3>
            <a href="#">
              <img src="/images/x.jpg" alt="" />
              Lorem ipsun........
            </a>
            <div style="clear:both;" />
          </li>
          <li>
            <h3>title</h3>
            <a href="#">
              <img src="/images/x.jpg" alt="" />
              Lorem ipsun........
            </a>
            <div style="clear:both;" />
          </li>
        </ul>
      </div>
    </div>
  </body>
</html>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

A combination of your answers fixed it. Many thank....

#list ul { display: block; }
#list li { display: block;}
#list a { display:block; height:100%; }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...