#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    9
    Rep Power
    0

    Will a psd turned into CSS scale with text?


    A thought crossed my mind. I plan on creating the web design for a site im developing in photoshop. A major part of my website uses unordered lists. The data in these lists can vary in by a decent amount. Is there a way to make the list able to scale with the amount of text, or enclose the text regardless?

    Thanks guys!
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4304
    What you are asking in not entirely clear. However, I'll remind you that it's best to avoid setting a fixed height on elements that contain text.

    The best web designs adapt to font-size and content length changes as well as different viewport sizes.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    9
    Rep Power
    0
    Sorry for the lack of information, I'll try and elaborate.

    What I want to do in psd is create a custom unordered list. In this custom list, I want every list item to have their own "box". So in photoshop, I want to create something simular to a facebook news feed, where every feed has its own "box". Another good example is textsfromlastnightDOTcom, where they have every item in the list has its own section when it is displayed on page.

    If created a simple box and psd and converted it to be included in css, is there a way to have the box scale to the size of the text inside it. From my understanding when I use psd, it will use that as an image in css. I'm just worried that the boxes will not scale to the amount of text.

    If this is still vague please let me know, and I will try to add more information
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4304
    Ah. Well it depends on how you implement it. There are several ways. These days it's often best to use as much CSS3 (e.g. border-radius and box-shadow) and as few images as possible, but you could use a technique like this one: CSS teaser box revisited For the images you do use for that, it's best to use optimized PNGs.

    Comments on this post

    • DonR agrees : using borders and such would definately be better/lighter for page loads than using images.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    869
    Rep Power
    275
    TO convert a box from psd to a variable height html/css layout, you will need to save the top slice of the box, the bottom slice of the box, and a horizontal width slice of the middle section.
    Then, you create your html/css pretty much like this
    Code:
    <div class="topboximage"></div>
    <div class="middleboximage">
    insert your text here
    </div>
    <div class="bottomboximage"></div>
    Code:
    <!-- Your CSS -->
    
    .topboximage{
    margin:0;
    padding:0;
    background:url("topboximage.jpg") no-repeat;
    height:<imageheight>;
    width:<imagewidth>;
    }
    .middleboximage{
    margin:0;
    padding:0;
    background:url("middleboximage.jpg" repeat-y;
    width:<imagewidth>;
    }
    .bottomboximage{
    margin:0;
    padding:0;
    background:url("topboximage.jpg") no-repeat;
    height:<imageheight>;
    width:<imagewidth>;
    }
  10. #6
  11. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4304
    @DonR That's one way to do a fixed width box. However, I don't recommend it. Instead I recommend you check out the example I linked to.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo