Quick question about textbox font alignment???

by askloz
18 replies
Hi guys,

I'm stumped. I'm normally quite good at css / html, but this has me stumped.

I have a textbox, which uses a 30px height by 150px width image that is used as the background and the text box is also set to 30px x 150px.

The prob I'm facing right now is the alignment of the font. It seems to be pushed at the top leaving a huge gap at the bottom. I tried adding padding, when used, it pushes my image out of wack, same too if i were to use margins as well.

Does anyone know of a way around this so my image stays in tact while aligning the font text say 5px from the left to create a padding, as that too with the right hand side, while keeping the text font bang smack in the middle of the text box?

Cheers in advance.
#alignment #font #question #quick #textbox
  • Profile picture of the author askloz
    no one out of all these programmers here?
    Signature
    {{ DiscussionBoard.errors[1614491].message }}
    • Profile picture of the author chaos69
      Originally Posted by askloz View Post

      no one out of all these programmers here?
      CSS/HTML is not programming :p

      That might sound completely unhelpful but its not intended to be. You might want to try your question in here instead;

      Website Design

      Also - im by no means an expert on css - but i dont recall coming across the problem you are describing. It might also help to give the link to the problem you are having so anyone answetring can see the problem themselves, along with the CSS you are using.

      Sorry i couldnt be more help.
      Signature
      Best Ways To Make Money Online

      Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
      “Yeah,” reply the bytes. “Make us a double.”
      {{ DiscussionBoard.errors[1614610].message }}
    • Profile picture of the author Mr. Enthusiastic
      Originally Posted by askloz View Post

      no one out of all these programmers here?
      There are always people ready to talk in the main forum. But the specialty forums like this one have a much lower volume of participation. Give questions here a day, not just a few hours. It's a worldwide forum and people check in throughout the day, as they happen to have time in their schedule.

      I recommend that you use two elements. One will be for the background image, the other for the text. This will let you adjust the text's position or padding without any effect on the image. Can you give this a try?

      If you have the text element inside a table cell, the vertical-align property may do what you need. Otherwise, one of the workarounds here might be what you need: Understanding vertical-align, or "How (Not) To Vertically Center Content".

      As someone mentioned you might get more people who can help with CSS in the design forum.

      Chris
      {{ DiscussionBoard.errors[1628238].message }}
      • Profile picture of the author askloz
        vertical align i've tried and don't work.

        I have used two elements, one with the background and one with just the text font. yet the same still happens

        it's driving me nuts, more so that no one here out of 100's of coders that they don't know how to do this.

        Oh hum...



        Originally Posted by Mr. Enthusiastic View Post

        There are always people ready to talk in the main forum. But the specialty forums like this one have a much lower volume of participation. Give questions here a day, not just a few hours. It's a worldwide forum and people check in throughout the day, as they happen to have time in their schedule.

        I recommend that you use two elements. One will be for the background image, the other for the text. This will let you adjust the text's position or padding without any effect on the image. Can you give this a try?

        If you have the text element inside a table cell, the vertical-align property may do what you need. Otherwise, one of the workarounds here might be what you need: Understanding vertical-align, or "How (Not) To Vertically Center Content".

        As someone mentioned you might get more people who can help with CSS in the design forum.

        Chris
        Signature
        {{ DiscussionBoard.errors[1629997].message }}
        • Profile picture of the author Mr. Enthusiastic
          Originally Posted by askloz View Post

          it's driving me nuts, more so that no one here out of 100's of coders that they don't know how to do this.
          As already mentioned:
          • You'll find more CSS gurus in the design forum
          • If you don't post your code, it's much harder for other people to troubleshoot it
          Try posting the troublesome code both here and in the design forum, and give people some time to tinker with it.
          {{ DiscussionBoard.errors[1630077].message }}
        • Profile picture of the author chaos69
          Originally Posted by askloz View Post

          it's driving me nuts, more so that no one here out of 100's of coders that they don't know how to do this.

          Oh hum...
          Once again. CSS is NOT coding.

          You will find more assistance for CSS problems in the DESIGN forum. However, if you dont post exactly what you are using it always makes the solution a lot harder [1].

          I posted this on the first reply to your post, yet your still here bitching about not getting help on a design problem. :confused:

          [1] TIM TOWTDI, as anyone from a coding background should understand
          Signature
          Best Ways To Make Money Online

          Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
          “Yeah,” reply the bytes. “Make us a double.”
          {{ DiscussionBoard.errors[1632583].message }}
  • Profile picture of the author mattalways
    Yah I'll need the code. Your question is not even clear what you're after. I kinda just felt like I'd let someone else handle this one haha Let me know and I'll help ya out
    Signature

    Quit wasting your money! If you need a website, get me to do it right! I'll probably even do it for less! Design/Development/Software, I'm your guy! matt@snidge.com
    {{ DiscussionBoard.errors[1614631].message }}
  • Profile picture of the author rufaswan
    It seems like there are some style inherited from somewhere and you didn't cancel / redefine it properly. I would suggest you post a link so we can actually see some codes, or you can download "Firebug" (and addon for Firefox) to inspect the problem yourself.

    - Rufas
    {{ DiscussionBoard.errors[1615713].message }}
  • Profile picture of the author askloz
    I figured my question was very clear.

    the default textbox will show the text in the box correctly when typed into, but if you make the height of the box larger, you will find that the font is not aligned dead center of the text box. so how does one make it align dead center in the box when its typed into?

    Hope that was clear

    btw, can't show you the page cos its not live yet.

    cheers again.
    Signature
    {{ DiscussionBoard.errors[1620496].message }}
    • Profile picture of the author saschakimmel
      Well, you could also post the HTML and CSS code for that so we could check it out.

      Analyzing CSS problems without seeing the code is nearly impossible.
      Signature

      ** Get my ViralListMachine software now for free and build your own list virally by giving away free stuff @ http://www.virallistmachinegiveaway.com **

      {{ DiscussionBoard.errors[1620505].message }}
      • Profile picture of the author askloz
        it's just a normal text box that has a height of 30px and width of 150px.

        try it yourself see what happens, you'll see what i mean, it'll take 2 sec's.

        save the html page and then type in the box, you will see that the baseline of the text is positioned in in the middle with the top of the font touching the top of the text box.

        Like this



        Notice how the bottom part of the text is positioned in the middle, with no padding at the top of the box and a huge gap at the bottom?

        Originally Posted by saschakimmel View Post

        Well, you could also post the HTML and CSS code for that so we could check it out.

        Analyzing CSS problems without seeing the code is nearly impossible.
        Signature
        {{ DiscussionBoard.errors[1623840].message }}
  • Profile picture of the author rufaswan
    btw, can't show you the page cos its not live yet.
    Have you try "Firebug" yet? It might gives you an idea what's wrong with it.

    Just in case you don't know how to use it, I put in the links for two Firebug video tutorial:

    Part 1 - http://community.joomla.org/videos/f...t1_english.swf
    Part 2 - http://community.joomla.org/videos/f...t2_english.swf

    Hope it helps.

    - Rufas
    {{ DiscussionBoard.errors[1620673].message }}
  • Profile picture of the author askloz
    no one still able to solve this problem for me, please?
    Signature
    {{ DiscussionBoard.errors[1628027].message }}
  • Profile picture of the author pjCheviot
    Banned
    Your question probably was clear to most people but, as mentioned before, without the code to look at it is difficult to see exactly what you are doing at the moment.

    Showing an image of what is happening highlights the problem but unfortunately doesn't help with the solution.

    Hope that makes sense and you can now show the code for everyone.
    {{ DiscussionBoard.errors[1628059].message }}
    • Profile picture of the author askloz
      I dont see how, if you're a coder, then you'll know how to do this from scratch.. as i said before, its a basic textbox with no properties in it. plain, vanilla, i'm simply asking for a solution but i guess no one here can code in CSS2?

      Originally Posted by pjCheviot View Post

      Your question probably was clear to most people but, as mentioned before, without the code to look at it is difficult to see exactly what you are doing at the moment.

      Showing an image of what is happening highlights the problem but unfortunately doesn't help with the solution.

      Hope that makes sense and you can now show the code for everyone.
      Signature
      {{ DiscussionBoard.errors[1629994].message }}
      • Profile picture of the author saschakimmel
        Originally Posted by askloz View Post

        I dont see how, if you're a coder, then you'll know how to do this from scratch.. as i said before, its a basic textbox with no properties in it. plain, vanilla, i'm simply asking for a solution but i guess no one here can code in CSS2?
        Come on, I've been doing this stuff for 14 years!
        I'm not asking just for fun.
        Signature

        ** Get my ViralListMachine software now for free and build your own list virally by giving away free stuff @ http://www.virallistmachinegiveaway.com **

        {{ DiscussionBoard.errors[1631087].message }}
      • Profile picture of the author pjCheviot
        Banned
        Originally Posted by askloz View Post

        I dont see how, if you're a coder, then you'll know how to do this from scratch.. as i said before, its a basic textbox with no properties in it. plain, vanilla, i'm simply asking for a solution but i guess no one here can code in CSS2?
        When someone is "almost" there and have the basics of a code, and originally states that they are normally good at css/html - then using the code they already have (and we still don't know if it's css or html or whatever!) - and then to be shown exactly what to do with that code - to me - would be a better solution. If you don't want to give a hint of the code, then that's fine.

        A bit like you going to the sparky with a picture of a blown lightbulb and saying "fix it for me" - could be 101 reasons why it blew and those faults may still be there even if you simply changed the bulb.

        Or going to the mechanic with a picture of an engine saying "it won't start!"

        You get "the picture".

        If you are intent on using css2 then a good reference to start with would be Box model - there are lots more too.

        However - I hope someone has the time to solve it for you.

        All the best
        pj
        {{ DiscussionBoard.errors[1631419].message }}
  • Profile picture of the author askloz
    Thanks Weaver, I tried that, but it moved my image out of place by the amount of the padding.

    Caos69... CSS is a form of programming, it consists of a language known as CSS. And its' in a form of a CODE.

    PHP is in a form of a code, it's programming... just a different type of programming to allow more dynamic and input storage functionality...

    @Mr. Enthusiastic, well excuse me sir.. maybe the moderators can move it to that section?

    @saschakimmel, the time it took you to make that reply, would of been in the same amount of time it would of taken you to try the example out on dreamweaver to see what i mean. As I said, I have NO STYLE properties added to it other than what I had said. 30px height and 150px length. period.

    @pjCheviot, thanks for the reply, I found a solution, not a definite fix, but a solution all the same and that was to raise the size of the font.

    Thanks everyone for their replies & your time.
    Signature
    {{ DiscussionBoard.errors[1649986].message }}

Trending Topics