2 different text elements in one list item - possible?

Discussion in 'CSS' started by leonthelion, Aug 6, 2006.

  1. #1
    I think I am using the wrong position codes for my layout too, but the first thing I'd like to remedy is the navigation menu.

    Trying to get the "li a" text to be to the top left of the link item and the "li" text to be at the bottom right...

    here is the xhtml with embedded css(some Japanese text in page content, don't worry):

    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>木津川台歯科</title>
    
    
    
    
    <style type="text/css">
    
    body {
    
    margin-top: 0;
    background-color:#FFF;
    /*text-align:center; hack for IE?*/
    text-align:center;
    }
    
    div#container {
    width: 700px;
    
    background:#00FF33;
    
    margin-top: 0;
    text-align:left;
    
    border:thin solid #666666;
    }
    
    div#header {
    	background-image:url(images/toplogo.png);
    	background-color:#fff;
    	width:100%;
    	overflow:auto;
    	background-repeat: no-repeat;
    	
    }
    
    h1 {
    margin-top:0px;
    margin-left:120px;
    }
    
    h2 {
    margin-top:40px;
    margin-left:120px;
    }
    
    div#content_top{
    width:100%;
    background-color:#3333FF;
    overflow:auto;
    }
    div#content_bottom{
    width:100%;
    background-color:#FF00FF;
    overflow:auto;
    }
    
    div#footer2{
    background-color:#FFFFFF
    
    }
    
    div#topmenu{
    
    float:right;
    }
    
    li#topmenulist {
    	line-height: 49px;
    	float:left;
    	list-style-type:none;
    	/*margin-left: -40px;*/
    	margin-right:0px;
    	margin-top:0px;
    	padding-right:10px;
    	padding-left:10px;
    	background-image:url(images/topmenubk1.png);
    	font-size: 10px;
    	border-right-width: thin;
    	border-right-style: solid;
    	border-right-color: #999999;		
    }
    li#topmenulist_selected {
    	line-height: 49px;
    	float:left;
    	list-style-type:none;
    	/*margin-left: -40px;*/
    	margin-right:0px;
    	margin-top:0px;
    	padding-right:10px;
    	padding-left:10px;
    	background-image:url(images/topmenubk2.png);
    	font-size: 10px;
    	border-right-width: thin;
    	border-right-style: solid;
    	border-right-color: #999999;		
    }
    
    li#topmenulist a {
    	display:block;
    	text-decoration: none;
    		
    }
    
    li#topmenulist_selected a {
    	display:block;
    	text-decoration: none;
    	color:black;
    		
    }
    
    
    li#topmenulist a:hover {
    	display:block;
    	text-decoration: none;
    	background-image:url(images/topmenubk1.png);
    	
    }
    div#telephone{
    
    float:right;
    }
    
    div#leftmenu{
    float:left;
    width:200px;
    }
    
    div#flash{
    
    float:right;
    background-color:#fff;
    }
    
    li#leftmenulist {
    	line-height: 36px;
    	background: url(images/menulist.png) no-repeat;
    	list-style-type:none;
    	padding: 0;
    	margin-left: -40px;
    	padding-top:0px;	
    	color:red	;
    	font-size: 10px;
    	
    	
    }
    
    li#leftmenulist a {
    	color: white;
    	text-decoration: none;
    	
    	font-size:150%;
    	margin-left: 5px;
    	
    }
    
    li#leftmenulist a:hover {
    	color: black;
    	text-decoration: none;
    	
    	font-size:150%;
    	margin-left: 5px;
    	margin-top:-5px;
    }
    
    div#footer1{
    width:100%;
    height:30px;
    float:right;
    font-size:50%;
    }
    li#footer_list{
    		line-height: 30px;
    	float:left;
    	list-style-type:none;
    	/*margin-left: -40px;*/
    	margin-right:10px;	
    	background-color:yellow;
    	font-size: 10px;
    }
    
    div#footer2{
    float:left;
    width:100%;
    }
    
    div#left_content{
    float:left;
    width:50%;
    }
    
    div#right_content{
    float:right;
    width:50%;
    }
    </style>
    </head>
    <body>
    
    
    
    <div id="container">
    
    <div id="header">
    <div id="topmenu">
    
    <ul>
    <li id="topmenulist_selected"><a href="#">HOME</a></li>
    <li id="topmenulist"><a href="#">ご予約・お問合せ</a></li>
    <li id="topmenulist"><a href="#">求人情報</a></li>
    </ul>
    
    </div>
    <img name="toplogo"  />
    <h2>学研都市インプラントセンター</h2>
    <h1>木津川台歯科・矯正歯科</h1>
    <div id="telephone">
    <p>いー歯ここよ</p>
    <p>TEL. 0774-71-8553</p>
    
    
    
    </div>
    </div>
    
    <div id="content_top">
    
    
    
    
    
    <div id="leftmenu">
    <ul>
    <li id="leftmenulist"><a href="#">一般歯科</a>general dentistry</li>
    <li id="leftmenulist"><a href="#">インプラント</a>dental implant</li>
    <li id="leftmenulist"><a href="#">審美歯科</a>esthetic dentistry</li>
    <li id="leftmenulist"><a href="#">予防歯科</a>preventative dentistry</li>
    <li id="leftmenulist"><a href="#">矯正歯科</a>orthodontic dentistry</li>
    <li id="leftmenulist"><a href="#">クリニックのご案内</a>information</li>
    <li id="leftmenulist"><a href="#">ご予約・お問合せ</a>online appintment</li>
    <li id="leftmenulist"><a href="#">無料フォト診断</a>free diagnosis</li>
    <li id="leftmenulist"><a href="#">無料メール相談</a>mail consultation</li>
    </ul>
    </div>
    
    <div id="flash">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="227" height="27">
        <param name="movie" value="text1.swf" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#FFFFFF" />
        <embed src="text1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="500px" height="27" bgcolor="#FFFFFF"></embed>
      </object>
      <p>this is under flash text</p>
    </div>
    </div>
    <div id="content_bottom">
    <div id="left_content">
    left content
    
    </div>
    
    <div id="right_content">
    right content
    </div>
    
    </div>
    </p>
    <div id="footer1">
    <ul>
    <li id="footer_list"><a href="#">サイトマップ</a></li>
    <li id="footer_list"><a href="#">個人情報保護方針</a></li>
    </ul>
    </div>
    
    <div id="footer2">
    <p>Copyright (C) 2006 kidugawadai-shika All Rights Reserved.<p>
    </div>
    
    
    
    
    </body>
    </html>
    
    Code (markup):
     
    leonthelion, Aug 6, 2006 IP
  2. briansol

    briansol Well-Known Member

    Messages:
    221
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Your main issue is that you are mis-using id's. An ID can only be used ONCE per page. If you want to use it multiple times, it needs to be a .class.

    There's tons wrong with the markup and css because of this. Re-run the code through a validator.

    to achive your positioning, your best bet is to use negative margins.
    on the li a, margin: -30px 0 0 0;
    on the li, margin: 0 -30px -10px 0;

    that should do the trick once your classing issues are addressed.
    http://css-discuss.incutio.com/?page=ClassesVsIds
     
    briansol, Aug 10, 2006 IP