Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Web App label text centering

Posted on 2004-11-02
11
Medium Priority
?
185 Views
Last Modified: 2010-04-23
Hi,

     I have a label in a web app.  It displays a barcode for whatever item is selected.  Some are long, some are short, so I want the text in the label to be centered.  The box is right above a button to print the barcode, so it looks strange when the barcode hangs way to the left of the box.

Thanks!

JP
0
Comment
Question by:gleznov
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 28

Accepted Solution

by:
iboutchkine earned 1000 total points
ID: 12473485
you have to add styles to the textbox or label

.TextBoxAlignRight
{
    text-align : right;
}

<asp:TextBox id="tb1" runat="server" CssClass="TextBoxAlignRight" />


Then drag and drop Styles.css to the form

for center alignment
.TextBoxAlignCenter
{
    text-align : center;
}
0
 

Author Comment

by:gleznov
ID: 12473867
Can you give me more info?  That looks like java?  Where do I put that?  VB code?  HTML?

JP
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12474057
If you open any web appplication, in the solution explorer you will see Styles.css file. This is cascading style sheet file.
Double click on it and modify it there. Or another choice is to create your own css file and add to the project. When you finish modification, drag this file from the edxplorr to the page to apply to the whole page . Or if you want to apply to only on econtrol, go to the properties and enter the nyme of css to the CssClass properties
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:gleznov
ID: 12483614
Here's what I've got:

/* Default CSS Stylesheet for a new Web Application project */

BODY
{
    BACKGROUND-COLOR: white;
    FONT-FAMILY: Verdana, Helvetica, sans-serif;
    FONT-SIZE: .8em;
    FONT-WEIGHT: normal;
    LETTER-SPACING: normal;
    TEXT-TRANSFORM: none;
    WORD-SPACING: normal
}

.TextBoxAlignCenter
{
    text-align : center;
}

H1, H2, H3, H4, H5, TH, THEAD, TFOOT
{
    COLOR: #003366;
}
H1      {      
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size:      2em;
      font-weight:      700;
      font-style:      normal;
      text-decoration:      none;
      word-spacing:      normal;
      letter-spacing:      normal;
      text-transform:      none;
      }      
            
H2      {      
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size:      1.75em;
      font-weight:      700;
      font-style:      normal;
      text-decoration:      none;
      word-spacing:      normal;
      letter-spacing:      normal;
      text-transform:      none;
      }      
            
H3      {      
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size:      1.58em;
      font-weight:      500;
      font-style:      normal;
      text-decoration:      none;
      word-spacing:      normal;
      letter-spacing:      normal;
      text-transform:      none;
      }      
            
H4      {      
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size:      1.33em;
      font-weight:      500;
      text-decoration:      none;
      word-spacing:      normal;
      letter-spacing:      normal;
      text-transform:      none;
      }      
            
H5, DT      {      
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size:      1em;
      font-weight:      700;
      font-style:      normal;
      text-decoration:      none;
      word-spacing:      normal;
      letter-spacing:      normal;
      text-transform:      none;
      }      
            
H6      {      
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size:      .8em;
      font-weight:      700;
      font-style:      normal;
      text-decoration:      none;
      word-spacing:      normal;
      letter-spacing:      normal;
      text-transform:      none;
      }      
            
TFOOT, THEAD      {      
      font-size:      1em;
      word-spacing:      normal;
      letter-spacing:      normal;
      text-transform:      none;
      font-family: Arial, Helvetica, sans-serif;
      }      
            
TH      {      
      vertical-align:      baseline;
      font-size:      1em;
      font-weight:      bold;
      word-spacing:      normal;
      letter-spacing:      normal;
      text-transform:      none;
      font-family: Arial, Helvetica, sans-serif;
      }      

A:link      {      
      text-decoration:      none;
      color:      #3333cc;
      }      
            
A:visited      {      
      text-decoration:      none;
      color:      #333399;
      }      
            
A:active      {      
      text-decoration:      none;
      color:      #333399;
      }      
            
A:hover      {      
      text-decoration:      underline;
      color:      #3333cc;
      }
      
SMALL      {      
      font-size:      .7em;
      }      

BIG      {      
      font-size:      1.17em;
      }      

BLOCKQUOTE, PRE      {      
      font-family:      Courier New, monospace;
      }      
      

UL LI      {      
      list-style-type:      square ;
      }      

UL LI LI      {      
      list-style-type:      disc;
      }      

UL LI LI LI      {      
      list-style-type:      circle;
      }      
      
OL LI      {      
      list-style-type:      decimal;
      }      

OL OL LI      {      
      list-style-type:      lower-alpha;
      }      

OL OL OL LI      {      
      list-style-type:      lower-roman;
      }      

IMG       {
      margin-top: 5px;
      margin-left: 10px;
      margin-right: 10px;
      }


Did I put that in the wrong place?  I put the name of the CSS file into the parameter for that control, but it still doesn't center the text.  Do I need to do something else?

JP
0
 

Author Comment

by:gleznov
ID: 12483653
<asp:label id="lblBarCode" style="Z-INDEX: 138; LEFT: 448px; POSITION: absolute; TOP: 488px"
                        runat="server" Font-Size="XX-Large" Font-Names="Free 3 of 9" Height="48px" Width="256px" CssClass="TextBoxAlignCenter" CssClass="StyleSheet1.css >

for the button - I've tried both of the CssClass, I included both in the above example just for simplicity, but each time I've run it, only one or the other was there.

JP
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12483887
I did it for the text box and everything worked fine. Maybe for the label it is not TextBoxAlign? I am not sure
0
 

Author Comment

by:gleznov
ID: 12484384
Hmmm, trying some things, but no luck yet.

JP
0
 

Author Comment

by:gleznov
ID: 12486080
I dunno.  Any ideas?

JP
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12486194
No clue. But try to put
.TextBoxAlignCenter
{
    text-align : center;
}

into default css file and then try again
0
 

Author Comment

by:gleznov
ID: 12486214
That's the one that didn't work - I tried:

.LabelAlignCenter
{
     text-align : center;
}

but no luck there either.

JP
0
 

Author Comment

by:gleznov
ID: 12705410
I finally wrote a routine to do it myself.  Thanks for trying though.

JP
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question