css for menu and inserted search box

I have a child theme of simple market and I have inserted a search box at the end using the following code

add_filter('wp_nav_menu_items','add_search_box', 10, 2);
function add_search_box($items, $args) {

$searchform = ob_get_contents();

$items .= '<li id="menu-item-search">' . $searchform . '';

return $items;
this works fine in that it is putting the search box there but I wanted it to go to the right of the menu bar. A general look through google for this seemed to indicate that
#menu-item-search {
float : right!important;
should work but it doesn't make any difference?