Tuesday, May 6, 2014

Building a nice looking login page with custom CSS ||PHPRUNNER

PHPRunner 7.0 and ASPRunnerPro 8.0 add a new new 'Custom CSS' feature - an easy way to modify the appearance of your pages adding bells and whistles Style Editor doesn't support. Lets see how we can build a custom login page similar to this one:

Lets start with some basic stuff.
Here is how you can set image as a background of the login page:
  1. body.function-login {
  2. height:100%;
  3. background:transparent url("http://mywebsite.com/images/some_image.jpg") no-repeat center center fixed;
  4. background-size:cover;
  5. }

What is body.function-login by the way?

body.function-login means this background will be only applied to the login page. If you want to apply this background to all List pages use the following:
  1. body.function-list {
  2. height:100%;
  3. background:transparent url("http://mywebsite.com/images/some_image.jpg") no-repeat center center fixed;
  4. background-size:cover;
  5. }
To figure out class names of individual pages you will need either Firefox browser with Firebug or Chrome. Here is the screenshot of body tag inspected in Chrome Developer Tools.

What if I want to apply this background image to all page in my application?

It's not difficult at all. Simply use body tag in Custom CSS:
  1. body.function-list {
  2. height:100%;
  3. background:transparent url("http://mywebsite.com/images/some_image.jpg") no-repeat center center fixed;
  4. background-size:cover;
  5. }

Okay, I'm getting it. What if I have a single List page that needs to have her own background?

This can be done as well. Custom CSS belongs to the current selected Style. If you assign a custom Style to one of List pages you can use Custom CSS that will be assigned to that single List page only.
We proceed to the Style Editor, make sure this List page is selected, choose "Apply to the current page" in Styles section and choose a different style for this page. Now we can proceed to Custom CSS and set different image as a background for this page.
  1. body.function-list {
  2. height:100%;
  3. background:transparent url("http://mywebsite.com/images/some_other_image.jpg") no-repeat center center fixed;
  4. background-size:cover;
  5. }

Got it. What about that semi-transparent login form?

Here is the code that does the job.
  1. .function-login .rnr-c > * {
  2. background: rgba(17,17,17,0.85) !important;
  3. }

What about Add page? I need the same look and feel there.

It will be slightly different. The same idea though.

  1. .function-add .rnr-c > * {
  2. background: rgba(17,17,17,0.85) !important;
  3. }
I have applied this code to the login page. This is what I got.

Not bad! This can be enough for most projects however with some extra work we can make it look exactly like a screenshot of the beginning of this article. Lets get started.
1.  Proceed to Security screen, turn on Facebook login and Password reminder.
2. Proceed to Style Editor, select Login page on the left, choose 'Apply to the current page' option from  'Project layouts'. Choose login1 layout.
3. You may notice that login page form is a bit wider than what we are after. Click 'Customize layout' and remove width=500 snippet.
4. Lets spend some time in Visual Editor now. We need to move Facebook button to the top and also move username/password labels so they appear on the top of input boxes.
Before moving form labels I recommend to turn on Show Borders mode.
Drag username input box to the left column and position it under Username label. You will need to use Enter button to insert a line break between the label and the field itself. Do the same with password field. Now delete the right column, we don't need it anymore.
Moving Facebook button should be easy. Just click on it and drag it to the top of the form.
5. Now lets change some labels. Click on 'Submit' button, switch to HTML mode and change 'Submit' to 'LOG IN'.
6. Switch back to Visual Mode. Select 'Remember password' link and switch to HTML mode again. We need to modify this link adding CSS forgot class. This class will be later defined in Custom CSS section. Here is howRemember password link is supposed to look in HTML code.
  1. <A class="forgot" href="remind.php">
  2. Forgot your password?
  3. </A>
7. Since built-in Facebook button doesn't support the style we looking we need to replace it with own own button. For this purpose click on Facebook button, switch to HTML code and replace button's HTML code with the following:
  1. <a href="#" onclick="window.login();return false;">
  2. Log in with Facebook
  3. </a>
It will not look nice until we apply our custom CSS. Do not worry, we'll get to it in a few seconds.
8. Now here is the CSS code and glues it all together. I'm posting it as a single code snippet so you can copy and paste it to your project. Note that this code requires one more image file (facebook.png), that appears on Facebook button. You can download it from the Web, upload somewhere to your website and modify image URL in CSS code accordingly. We use icon size 29x29px in this example.
  1. /* makes login form semi-transparent */
  2. .function-login .rnr-c > *
  3. {
  4. background: rgba(17,17,17,0.85) !important;
  5. }
  6.  
  7. /* login page background */
  8. body.function-login {
  9. height:100%;
  10. background:transparent url("http://yourwebsite.com/images/homepage.jpg") no-repeat center center fixed;
  11. background-size:cover;
  12. }
  13.  
  14. /* styling of 'remember password' link */
  15.  
  16. a.forgot {
  17. color: #70d4dd;
  18. text-decoration: none;
  19. font-family: 'Open Sans', sans-serif;
  20. font-size: 12px;
  21. font-style: normal;
  22. font-weight: normal;
  23. font-variant: normal;
  24. }
  25.  
  26. /* sets height of the login form header */
  27. .rnr-b-loginheader {
  28. height: 100px;
  29. }
  30.  
  31. /* Facebook button styling */
  32.  
  33. .facebook {
  34. -webkit-box-shadow: rgb(152, 202, 245) 0px 2px 0px -1px inset, rgba(64, 64, 64, 0.298039) 0px 2px 2px 0px;
  35. background-attachment: scroll;
  36. background-clip: border-box;
  37. background-color: rgb(0, 131, 213);
  38. background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0.05, rgb(80, 164, 216)), to(rgb(0, 131, 213)));
  39. background-origin: padding-box;
  40. background-size: auto;
  41. border-bottom-color: rgb(8, 135, 213);
  42. border-bottom-left-radius: 3px;
  43. border-bottom-right-radius: 3px;
  44. border-bottom-style: solid;
  45. border-bottom-width: 1px;
  46. border-image-outset: 0px;
  47. border-image-repeat: stretch;
  48. border-image-slice: 100%;
  49. border-image-source: none;
  50. border-image-width: 1;
  51. border-left-color: rgb(8, 135, 213);
  52. border-left-style: solid;
  53. border-left-width: 1px;
  54. border-right-color: rgb(8, 135, 213);
  55. border-right-style: solid;
  56. border-right-width: 1px;
  57. border-top-color: rgb(8, 135, 213);
  58. border-top-left-radius: 3px;
  59. border-top-right-radius: 3px;
  60. border-top-style: solid;
  61. border-top-width: 1px;
  62. box-shadow: rgb(152, 202, 245) 0px 2px 0px -1px inset, rgba(64, 64, 64, 0.298039) 0px 2px 2px 0px;
  63. color: rgb(255, 255, 255);
  64. cursor: auto;
  65. display: block;
  66. font-family: 'Open Sans', sans-serif;
  67. font-size: 16px;
  68. font-style: normal;
  69. font-variant: normal;
  70. font-weight: bold;
  71. height: 49px;
  72. line-height: 49px;
  73. list-style-image: none;
  74. list-style-position: outside;
  75. list-style-type: none;
  76. margin-bottom: 0px;
  77. margin-left: auto;
  78. margin-right: auto;
  79. margin-top: 30px;
  80. outline-color: rgb(255, 255, 255);
  81. outline-style: none;
  82. outline-width: 0px;
  83. padding-bottom: 0px;
  84. padding-left: 32px;
  85. padding-right: 2px;
  86. padding-top: 0px;
  87. text-align: left;
  88. text-decoration: none;
  89. text-shadow: rgb(0, 0, 0) 0px -1px 1px;
  90. text-transform: uppercase;
  91. vertical-align: baseline;
  92. width: 252px;
  93. background: -moz-linear-gradient(center top , #50A4D8 5%, #0083D5 100%) repeat scroll 0 0 transparent;
  94. }
  95.  
  96. a.facebook-icon:before {
  97. background: url(http://yourwebsite.com/images/facebook.png) no-repeat;
  98. content: '';
  99. display: inline-block;
  100. width: 29px;
  101. height: 29px;
  102. position: relative;
  103. left: -15px;
  104. top: 9px;
  105. }
  106.  
  107. /* make input boxes on the login page slightly large */
  108.  
  109. .function-login input[type=text], .function-login input[type=password] {
  110. background-color: #ffffff;
  111. border: 1px solid #c3c2c2;
  112. -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
  113. -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
  114. box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
  115. width: 290px !important;
  116. display: inline-block;
  117. height: 26px;
  118. padding: 0px 6px;
  119. margin: 5px 0 0 0;
  120. font-size: 12px;
  121. line-height: 14px;
  122. color: #555555;
  123. -webkit-border-radius: 4px;
  124. -moz-border-radius: 4px;
  125. border-radius: 4px;
  126. }
  127.  
  128. .function-login .rnr-page {
  129. margin: 50px auto 0 auto;
  130. padding: 0 0 20px 0;
  131. display: block;
  132. }
  133.  
  134. /* width of the login form */
  135.  
  136. .function-login .rnr-c-fields {
  137. width: 350px;
  138. }
  139.  
9. One last piece is the "LOG IN" button styling. In this example I have done this using Style Editor. Remember that this is the "Main button" style. Use 'Lato' font, 16px font size, bold if you want to create something similar.
If you done everything right here is how your login page is going to look in Visual Editor.
"Message" area is where "Invalid login" message will appear.
What else would you like to know?


Sumber :http://xlinesoft.com/blog/2013/10/26/building-a-nice-looking-login-page-with-custom-css/

1 comment:

Blog Archive

Labels

Follow us on facebook

Labels

Featured Posts

Popular Posts

Menu

Ad 728×90px

Contact Form

Name

Email *

Message *

Recent Posts

Contact Us

Name

Email *

Message *

Find Us