473,588 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Placing input controls on top of an image

nathj
938 Recognized Expert Contributor
Hi,

I'm surrently struggling with something I'm certain should be very simple. I'm working on a new web application that requires every user to login before they do anything else. This means that the first page is a login page.

I have produced simple graphic for the login form and I want the controls to sit within this. Unfortunately this is all just local only at the moment and so I can show you the results.

The code is as follows:

LoginPage_layou t.css
Expand|Select|Wrap|Line Numbers
  1. /* General Document Format */ 
  2. html, body, ul, ol, li, p, blockquote, q,
  3. h1, h2, h3, h4, h5, h6, fieldset, legend,
  4. form, label, a, div, img, dd, dt, dl, input, span, img
  5. {
  6.     margin                : 0px;
  7.     padding                : 0px;
  8.     border                : 0px;
  9. }
  10.  
  11. body
  12. {    
  13.     font-family            : verdana, "trebuchet MS", helvetica, sans-serif;
  14.     font-size            : 11px; 
  15.     line-height            : 1.637; 
  16.     margin                : 0px 0px;
  17.     padding                : 0px;
  18.     height                : 100%;    
  19.     text-align            : center ; 
  20. }                            
  21.  
  22. /* Containers */
  23. div.loginContainer
  24. {
  25.     width                : 315px ;
  26.     height                : 212px ;
  27.     margin-left            : auto ; 
  28.     margin-right        : auto ; 
  29.     margin-top            : 194px ;
  30.     margin-bottom        : 194px ; 
  31.     background-image    : url("../image/LoginFormBackground.png") ;
  32.     background-repeat    : no-repeat ;
  33.     border                : solid 2px #602103;
  34. }
  35.  
  36.     div.loginContainer img
  37.     {
  38.         display                : inline ;
  39.     }
  40.  
  41.     form.loginForm
  42.     {
  43.         width                : 315px ; 
  44.         height                : 212px ;     
  45.         margin-left            : auto ;
  46.         margin-right        : auto ;
  47.         margin-top            : 194px ; 
  48.         margin-bottom        : 194px ;        
  49.         border                : solid 2px #FF0000;
  50.     }
  51.  
  52.     div.username
  53.     {
  54.         position            : relative ;
  55.         display                : inline ;
  56.         left                : 2px ;
  57.         width                : 230px ;
  58.         top                    : 1px ;
  59.         height                : 26px ;    
  60.         border                : solid 2px #FFFF00;
  61.     }
  62.  
  63.     div.password
  64.     {
  65.         position            : relative ;
  66.         display                : inline ;
  67.         left                : 2px ;
  68.         width                : 230px ;
  69.         top                    : 28px ;
  70.         height                : 26px ; 
  71.         border                : solid 2px #0000FF;
  72.     }
  73.  
  74.     div.loginButton
  75.     {                                
  76.         position            : relative ;
  77.         left                : 112px ;
  78.         width                : 100px ;
  79.         top                    : 185px ;
  80.         height                : 28px ;  
  81.         border                : solid 2px #00FF00;
  82.     }
  83.  
  84.  
ResponseTracker _colour.css
Expand|Select|Wrap|Line Numbers
  1. body
  2. {    
  3.     background            : #eeeafe ;
  4. }
  5.  
  6. /* Containers */
  7. div.loginContainer
  8. {
  9.     background            : #eeeafe ;
  10. }
  11.  
  12.  
The borders in the first css file are there only for testing and development - they enable me to see where everything is properly.

Login.html
[html]
<head>
<link rel="stylesheet " type="text/css" href="style/responsetracker _colour.css" />
<link rel="stylesheet " type="text/css" href="style/loginpage_layou t.css" />
</head>
<body>
<div class="loginCon tainer">
<form class="loginFor m" name="frm_Login " method="post" action="mainpag e.php">
<div class="username ">
Username: <input type="text" id="username" title="Please enter your ResponseTracker username" />
</div>
<div class="password ">
Password: <input type="password" id="access" title="Please enter your ResponseTracker password" />
</div>
<div class="loginBut ton">
<input name="login" type="image" src="image/loginButton.png " alt="Login" title="Click to login" onmouseover="th is.style.cursor ='pointer'" onclick="frm_Lo gin.submit()"/>
</div>
</form>
</div>
</body>

[/html]

I'm pretty new to CSS and still learning so I'm certain there is an easy way to achieve this. What I want is for the input controls and the button image to be on top of the picture.

Thanks in advance
nathj
Oct 26 '07 #1
1 2829
nathj
938 Recognized Expert Contributor
Hi,

Since making my original post I have solved the problem - I was right, it was a bit of stupidity on my part. Anyway the problem has been solved and here is the new code.
loginPage_layou t.css
Expand|Select|Wrap|Line Numbers
  1.  
  2. /* General Document Format */ 
  3. html, body, ul, ol, li, p, blockquote, q,
  4. h1, h2, h3, h4, h5, h6, fieldset, legend,
  5. form, label, a, div, img, dd, dt, dl, input, span, img
  6. {
  7.     margin                : 0px;
  8.     padding                : 0px;
  9.     border                : 0px;
  10. }
  11.  
  12. body
  13. {    
  14.     font-family            : verdana, "trebuchet MS", helvetica, sans-serif;
  15.     font-size            : 11px; 
  16.     line-height            : 1.637; 
  17.     margin                : 0px 0px;
  18.     padding                : 0px;
  19.     height                : 100%;    
  20.     text-align            : center ; 
  21. }                            
  22.  
  23. /* Containers */
  24. div.loginContainer
  25. {
  26.     width                : 315px ;
  27.     height                : 212px ;
  28.     margin-left            : auto ; 
  29.     margin-right        : auto ; 
  30.     margin-top            : 194px ;
  31.     margin-bottom        : 194px ; 
  32.     background-image    : url("../image/LoginFormBackground.png") ;
  33.     background-repeat    : no-repeat ;
  34. }
  35.  
  36.     div.username
  37.     {
  38.         position            : relative ;
  39.         left                : 15px ;
  40.         width                : 230px ;
  41.         top                    : 70px ;
  42.         height                : 26px ;    
  43.     }
  44.  
  45.     div.password
  46.     {
  47.         position            : relative ;
  48.         left                : 15px ;
  49.         width                : 230px ;
  50.         top                    : 80px ;
  51.         height                : 26px ; 
  52.     }
  53.  
  54.     div.loginButton
  55.     {                                
  56.         position            : relative ;
  57.         left                : 200px ; 
  58.         width                : 100px ;
  59.         top                    : 120px ;
  60.         height                : 28px ;  
  61.     } 
  62.  
  63. /* Form Layout and Presentation */
  64.  
  65. input.textBased
  66. {
  67.     border                : solid 1px #808080 ;
  68.     height                : 18px ; 
  69.     width                : 150px ;
  70.     margin-left            : 2px ;
  71. }                                 
  72.  
ie_layout.css
Expand|Select|Wrap|Line Numbers
  1. div.loginButton
  2. {                                
  3.     left                : 100px ; 
  4. }
  5.  
And the HTML is:
loginPage.html
[html]
<head>
<!-- no meta tags as this is not intended to be found by a serch system -->
<link rel="stylesheet " type="text/css" href="style/responsetracker _colour.css" />
<link rel="stylesheet " type="text/css" href="style/loginpage_layou t.css" />
<!--[if IE]>
<link rel="stylesheet " type="text/css" href="style/ie_layout.css"/>
<![endif]-->
</head>
<body>
<div class="loginCon tainer">
<form name="frm_Login " method="post" action="mainpag e.php">
<div class="username ">
Username: <input class="textBase d" type="text" id="username" title="Please enter your ResponseTracker username" />
</div>
<div class="password ">
&nbsp;Passwo rd: <input class="textBase d" type="password" id="access" title="Please enter your ResponseTracker password" />
</div>
<div class="loginBut ton">
<input name="login" type="image" src="image/loginButton.png " alt="Login" title="Click to login" onmouseover="th is.style.cursor ='pointer'" onclick="frm_Lo gin.submit()"/>
</div>
</form>
</div>
</body>
[/html]

This results in the form being positioned on top of the image giving a much nicer look to the initial login page.

Many thanks
nathj

PS If you have a better way of doing this then please let me know
Oct 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5077
by: Bettina | last post by:
I have a text field and I want that after I enter a text in this text field, the focus goes to the button.gif. How can I do it? Any ideas? I know that when you use an input type="submit", the focus goes automatically to the button, but I don't want to use a button. See please the piece of code: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html;
2
2812
by: Dickyb | last post by:
Extracting an Icon and Placing It On The Desktop (C# Language) I constructed a suite of programs in C++ several years ago that handle my financial portfolio, and now I have converted them to C#. The only significant problem that I have encountered in the conversion is this one - extracting an icon from the 'KTEntryPoint' program into the software suite and placing that icon on the PC Desktop.
1
1798
by: objectref | last post by:
Hi to all folks, i have the following problem and i have spent many hours to solve it but without any result, so, here it is: Imagine that you have a mdi-child form that has a panel on it, a panel that it's height has the value of 3000. The panel also has a vertical scrollbar so i can
1
1514
by: dwa | last post by:
This is a bit off-topic, but... Is it possible to write client side script that can address INPUT controls with a type of "image" which will work under Netscape/Mozilla? <INPUT type="image" ...> Controls of this type are excluded from the forms.elements collection and 'document.all' isn't supported my Mozilla browsers?
3
2779
by: Nathan Sokalski | last post by:
When I view any page in my application a second time, I recieve the following error: System.Web.TraceContext.AddNewControl(String id, String parentId, String type, Int32 viewStateSize) +313 System.Web.UI.Control.BuildProfileTree(String parentId, Boolean calcViewState) +201 System.Web.UI.Control.BuildProfileTree(String parentId, Boolean calcViewState) +263
17
3185
by: Alan Silver | last post by:
Hello, I have a page which I am converting to use themes. The page has an HTML <input type="image"> element that is used to post to another page. I would like to replace this with a server control so I can add a skinid. I tried adding runat="server" and the skinid to the existing control, but that didn't work. Any other ideas? TIA --
2
6598
by: jon | last post by:
Hi This might be an easy one to answer but I have a web form in an ASP.NET 1.1 application with a hand-rolled HTML image button as follows which opens a help guide in a new window: <input type= "image " id= " imgHelp " onclick="javascript:void(window.open('<% Response.Write(ConfigurationSettings.AppSettings); %>')) ">
3
21250
by: jackiepatti | last post by:
QUESTION: I have a web page containing a form that contains an image instead of a submit button, e.g. <form name='myform' action='get' method='otherpage.asp'> <input type='image' src='picture.gif' name='myimage' id='myimage'> </form> When forms with image types are submitted, the value is not returned; instead, when the form is submitted, the XY coordinates of the where the user clicked on the image are sent. For example, if the user
3
1742
by: Valli | last post by:
Hi, I want to add an image to a html type input button. How can I do this? I have used background image style . But its not working. My target is to show an image in the button can anyone help me? -- Regards
0
7929
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7860
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8223
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6634
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5726
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3847
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2371
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.