Results 1 to 8 of 8

Thread: better way of making this button

  1. #1
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default better way of making this button

    can anyone help me write this more efficiently?

    i have a button that is 150px X 120px with a simple text inside that i would like to have control over the placement.
    I want the entire button to be clickable, so i placed a 1pixel gif as a img inside and gave it the same dimension as the button
    then i had to move the entire img up so that it is placed within the main buttons parameter

    seems a bit overcomplicated for something that can have a simpler solution

    Code:
    <html>
    	<head>
    		<style>
    		#btnDiv{background-color:#CCC; width:150px; height:120px; text-indent:20px;}
    		#btnDiv span{position:relative; top:30px; left:40px; background-color:#999;}
    		#btnDiv img{margin-top:-20px;}
    		</style>
    	</head>
    	<body>
    	<div id='btnDiv'><a href='#'><span>btn</span><img src='x.gif' width='150' height='120' /></a></div>
    	</body>
    </html>
    Last edited by ggalan; 12-10-2010 at 04:29 AM.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    One question before I recode this - did you want an actual button like the type you'd see under a form, like "Submit"? Or did you want a clickable-link type button?
    Jeremy | jfein.net

  3. #3
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    more like the submit, maybe with 2 or 3 lines of text
    thanks!

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I'm sorry for asking that question originally, it seems like a link would be more ideal for this.
    Code:
    <style type="text/css">
    a.button {
    background-color:#CCC;
    display: block;
    width: 150px;
    height: 120px;
    line-height: 120px;
    text-align: center;
    }
    a.button span {
    background-color:#999;
    }
    </style>
    <a href="#" class="button"><span>Btn</span></a>
    Jeremy | jfein.net

  5. The Following User Says Thank You to Nile For This Useful Post:

    ggalan (12-10-2010)

  6. #5
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    display:block!
    thanks

    how would you add lets say 3 lines of text?

  7. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Would your three lines classify as a list? If not - just use <br />
    Jeremy | jfein.net

  8. #7
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    i guess thats what i was wondering, when would you use a "ul li" vs "br" ?

  9. #8
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    If you were listing things, you would put it in a list...
    http://www.w3.org/TR/html401/struct/lists.html
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •