Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2010
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    CSS Buttons withint a div style

    How do I control the buttons? When I make changes to the input tag it effects the buttons:
    style sheet code
    Code:
    #search input, select{
    	height:20px;
    	margin-left: 15px;
    	background: #ECF9E4;	
    	color: #000000;
    	font: 14px Georgia, "Times New Roman", Times, serif;	
    }
    HTML code
    Code:
    <div style=search>
    <tr>
    <td colspan="3" align="right">
    <input type="reset" value="Cancel" onclick="javascript:refresh();" ID="button1" name="button1" />
    <input type="button" value="Register" onclick="javascript:DoSubmit(1);" ID="Button2" name="Button2" />
    </td>
    </tr>
    </div>

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Code:
    #search input, select{}
    this selector basically translates to "apply these styles to ANY input elements in the div with an id of "search"

    this is a fairly specific selector so I would recommend you also use the button id to apply what style changes you are looking for like so

    Code:
    #button1{
    new styles here
    }
      
    
    or if you want both buttons to use this style then:
    #button1,#button2{
    styles here
    }
    if the buttons are going to have the same look then you could just add a new class and assign that class to both buttons and add your style changes that way, but since #search input is somewhat specific, a class may not be good enough

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts
    thanks for the reply. I did try and add the new class:
    [code]
    #button1,#button2{
    styles here
    }
    [code]
    and it had zero effect on the buttons.

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Code:
    <input type="reset" value="Cancel" onclick="refresh();" id="button1" name="button1" />
    <input type="button" value="Register" onclick="DoSubmit(1);" id="Button2" name="Button2" />
    For the above two, you need
    Code:
    #Button1, #Button2{
    
    }
    Last edited by abduraooft; 05-09-2011 at 04:06 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Quote Originally Posted by fogetaboutit View Post
    thanks for the reply. I did try and add the new class:
    [code]
    #button1,#button2{
    styles here
    }
    [code]
    and it had zero effect on the buttons.
    well you have to add the style changes you want silly . I'm guessing you don't know much about css ( nothing wrong with that we are all here to learn and grow) , so maybe you should be a little more specific. What changes would you like to apply to these 2 buttons?


  •  

    Posting Permissions

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