• 0

Form won't vertically centre in Opera


Question

I have a simple search form with one input field and a submit button. The fields are vertically centred in place using line height and this works well in all browsers except Opera.

Take a look here: http://kitescoop.com...ewforum.php?f=2

It is the search box in the top right corner.

What makes this especially confusing is that I have a custom home page for that forum here which uses a different stylesheet but practically the same code for the search form. On the home page, it centers fine.

Here is what it looks like in Opera:

xYWaJ.gif

Here is what it looks like in every other browser:

ORQIt.gif

Here is the relevant code:

HTML (look at <div id="search-box">)

&lt;div id="header-box"&gt;
	&lt;h1&gt;&lt;a href="{U_INDEX}"&gt;{SITENAME}&lt;/a&gt;&lt;/h1&gt;
	&lt;h2&gt;{SITE_DESCRIPTION}&lt;/h2&gt;
	&lt;div id="top-nav"&gt;
		&lt;!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH --&gt;
			&lt;div id="search-box"&gt;
				&lt;form action="{U_SEARCH}" method="post" id="search"&gt;
				&lt;fieldset&gt;
					&lt;input name="keywords" id="keywords" type="text" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search" value="&lt;!-- IF SEARCH_WORDS--&gt;{SEARCH_WORDS}&lt;!-- ELSE --&gt;{L_SEARCH_MINI}&lt;!-- ENDIF --&gt;" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" /&gt;
					&lt;input class="button2" value="{L_SEARCH}" type="submit" /&gt;
				&lt;/fieldset&gt;
				&lt;/form&gt;
			&lt;/div&gt;
			&lt;script type="text/javascript"&gt;
				$(function() {
					//find all form with class jqtransform and apply the plugin
					$("form.jqtransform").jqTransform();
				});
			&lt;/script&gt;
		&lt;!-- ENDIF --&gt;
	&lt;/div&gt;
	&lt;div id="main-nav"&gt;
		&lt;ul id="main-nav-primary"&gt;
			&lt;li&gt;&lt;a href="http://www.kitescoop.com/" class="nav-home"&gt;Home&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="http://www.kitescoop.com/videos/" class="nav-videos"&gt;Videos&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="http://www.kitescoop.com/photos/" class="nav-photos"&gt;Photos&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="http://www.kitescoop.com/forum/" class="nav-forum"&gt;Forum&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
		&lt;ul id="main-nav-secondary"&gt;
			&lt;li&gt;&lt;a href="http://www.kitescoop.com/articles/" class="nav-articles"&gt;Articles&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="http://www.kitescoop.com/interviews/" class="nav-interviews"&gt;Interviews&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="http://www.kitescoop.com/artists/" class="nav-artists"&gt;Artists&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="http://www.kitescoop.com/tricks/" class="nav-tricks"&gt;Tricks&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="http://www.kitescoop.com/store/" class="nav-store"&gt;Store&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/div&gt;
&lt;/div&gt;

CSS:

#header-box {
	background-color: #000;
	padding: 20px 9px 10px 9px;
	position: relative;
}

#header-box h1 {
	display: block;
	position: absolute;
	z-index: 10;
	left: 30px;
	top: 26px;
}

#header-box h1 a {
	display: block;
	background: transparent url('{T_THEME_PATH}/images/logo.gif') no-repeat top left;
	width: 242px;
	height: 144px;
	text-indent: -9000px;
}

#header-box h2 {
	display: none;
}

#top-nav {
	background: #000 url('{T_THEME_PATH}/images/menu_bg.gif') repeat-x top left;
	height: 41px;
}

#top-nav #search-box {
	float: right;
	height: 41px;
	line-height: 41px;
	margin-right: 16px;
}

#top-nav #search-box fieldset {
	border: none;
	height: 41px;
	padding: 0;
	margin: 0;
	font-size: 11px;
}

#top-nav #search-box fieldset input[type="text"] {
	height: 23px;
	width: 164px;
	background: transparent url('{T_THEME_PATH}/images/input.gif') no-repeat top left;
	border: none;
	padding: 0 4px;
	margin: 0;
	font-size: 11px;
	line-height: 23px;
	color: #919191;
}

#top-nav #search-box fieldset input[type="submit"] {
	height: 23px;
	width: 70px;
	background: #181818 url('{T_THEME_PATH}/images/search.gif') no-repeat top left;
	border: none;
	padding: 0;
	margin: 0;
	font-size: 11px;
	line-height: 23px;
	text-indent: -9000px;
	cursor: pointer;
}

#main-nav {
	margin-top: 16px;
	background: #000 url('{T_THEME_PATH}/images/under_menu_bg.gif') repeat top left;
	height: 108px;
	position: relative;
}

Link to full stylesheet: http://kitescoop.com.../stylesheet.css

Link to home page stylesheet for comparison: http://kitescoop.com.../home_style.css

Any help on this is much appreciated. I am completely stumped here.

Thanks,

Jordan

4 answers to this question

Recommended Posts

  • 0

EDIT: Aha. Looks like it's the Doctype. Using XHTML 1.0 Strict on the home page and XHTML 1.0 Transitional through the rest of the forum. I can't change the rest of the forum to strict as it would take too much work correcting errors. Got to find a workaround.

They look the same to me and the link looks like it should. Using Opera 12 build 1467.

That's the same version and build that I am using and I've tested it on 2 separate computers with the same broken result.

line-height works only fine with text with other lements it starts to give bugs, use margin instead

Line-height should work for all inline elements. Hence why it works in every other browser and even on the home page in Opera.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • This 4K webcam from Acer is now only $59.99 by Taras Buria Those looking for an affordable, high-resolution webcam from a reputable manufacturer can check out the latest deal from Acer, which puts its 4K webcam at a solid price. Thanks to a 14% discount, you can buy this all-metal 4K webcam from Acer for just $59.99. Despite the affordable price tag, the webcam has a pretty large 1/2" CMOS sensor manufactured by Sony. Apart from its size, it supports additional conveniences, such as high dynamic range and phase-detection autofocus (PDAF). Plus, the camera ensures you do not have to buy additional audio equipment, as it comes with two built-in high-sensitivity microphones, a built-in background noise filter, and the ability to pick up your voice from up to 2.5 meters away. Acer is not cheaping out on materials, and the webcam is enclosed in a more premium metal case, which is also good at heat dissipation (high-resolution cameras can get quite hot). And to make sure no one is peeping at you when the camera is in use, there is a magnetic cover also made of metal. Additional conveniences include an LED status indicator and a built-in mount that lets you place a camera on a tripod. Acer 4K Webcam for PC/Mac with All-Metal Unibody Sculpted - $59.99 | 14% off Good to know This Amazon deal is U.S.-specific and not available in other regions unless specified. We only use first-party seller links (at the time of article publishing); ensure that you purchase from a first-party seller link only. Check out Today's Deals on Amazon | or our recent tech deals. Become a Prime member (for Students or SNAP) via Neowin Get Prime Access - Prime for half price (for qualifying Medicaid, EBT, SNAP) Subscribe to Prime Video, Audible Plus, Music Unlimited, or Kindle Unlimited via Neowin As an Amazon Associate, we earn from qualifying purchases.
    • https://www.nvidia.com/en-us/g...back-thread-released-61626/ Best spot to find out if there are any issues b4 u deploy
    • Site is timing out for me.
    • Stop reporting AR glasses as an X inch screen, Y distance away. That is a horseshit meaningless spec. Report on the actual FOV angle. That's all that matters. And for the record, this FOV is ~49degrees. So we're talking about HoloLens level FOV... i.e. it's like looking through a piece of paper at arm's length.
    • I bought a 4TB Samsung 990 Pro for $250 brand new during Black Friday, to give some comparison. Things are getting absolutely ridiculous.
  • Recent Achievements

    • Conversation Starter
      NovaEdgeX earned a badge
      Conversation Starter
    • One Year In
      Console General earned a badge
      One Year In
    • One Year In
      Twozo Technologies earned a badge
      One Year In
    • One Month Later
      Twozo Technologies earned a badge
      One Month Later
    • Week One Done
      Twozo Technologies earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      519
    2. 2
      +Edouard
      185
    3. 3
      PsYcHoKiLLa
      107
    4. 4
      Steven P.
      88
    5. 5
      ATLien_0
      67
  • Tell a friend

    Love Neowin? Tell a friend!