Message created with CSS. What am I doing wrong?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    Message created with CSS. What am I doing wrong?

    Hello,

    I have been trying to create a simple feedback message do display on a
    web site.
    I am trying to have a message with an Icon on left and and Text on
    right.
    If possible both text and image would be vertical aligned to its
    container and between themselves.

    Anyway, this is what I came up:


    It is not working. And I think the CSS is getting to complex.

    Does anyone has a better solution or suggestion to solve this or do a
    nice feedback message?

    Thank You,
    Miguel
  • Jonathan N. Little

    #2
    Re: Message created with CSS. What am I doing wrong?

    shapper wrote:
    Hello,
    >
    I have been trying to create a simple feedback message do display on a
    web site.
    I am trying to have a message with an Icon on left and and Text on
    right.
    If possible both text and image would be vertical aligned to its
    container and between themselves.
    >
    Anyway, this is what I came up:

    >
    It is not working. And I think the CSS is getting to complex.
    >
    Does anyone has a better solution or suggestion to solve this or do a
    nice feedback message?
    I'll say! Also see what happens if you enlarge the text a bit!

    Noobie error: use absolute positioning to solve layout problems. Problme
    is absolutely positioned elements are removed for the layout flow!

    Stop being a code monkey and get the basics down first. My advice is go
    through the html and css tutorials at http://htmldog.com

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO

    Comment

    • Bergamot

      #3
      Re: GG Message created with CSS. What am I doing wrong?


      shapper wrote:
      >
      I am trying to have a message with an Icon on left and and Text on
      right.
      If possible both text and image would be vertical aligned to its
      container and between themselves.
      >
      http://www.27lamps.com/public/Message.htm
      This is way more complicated than it needs to be. First off, width:200px
      doesn't adapt to various text sizes. Zoom text up a couple notches, or
      set IE's text size to Largest and see what happens.

      The <pis absolutely positioned, so it overflows the div container.
      Does anyone has a better solution or suggestion to solve this
      Put the image in the background instead of the foreground and center it
      vertically.
      <p>Login failed. Please try again</p>

      p {
      background: #fcc url(Images/Error.gif) 5px 50% no-repeat;
      color: #900;
      border: 1px solid #c00;
      padding: .25em .5em .25em 45px; /* left pad for img size */
      }

      If you also float it left, it will shrink wrap to fit the text. Add
      margins to taste. Set a min-height if you don't want the image cropped
      at very small type sizes.

      --
      Berg

      Comment

      Working...