473,789 Members | 2,876 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 2834
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
5086
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
2817
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
1804
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
1518
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
2793
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
3211
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
6603
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
21273
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
1744
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
9511
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
10408
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
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9020
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
7529
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
6768
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
5417
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...
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.