Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6657245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:44:38+00:00 2026-05-26T01:44:38+00:00

I am trying to format a list of links with some css, I am

  • 0

I am trying to format a list of links with some css, I am having trouble though.

Please look at the image below…

enter image description here

<div class="tag-list">
    <a href="/tag/htaccess" >.htaccess</a>
    <a href="/tag/css-2" >css</a>
    <a href="/tag/database-2" >database</a>
    <a href="/tag/design-pattern">design pattern</a>
    <a href="/tag/mysql" >mysql</a>
    <a href="/tag/pdo" >PDO</a>
    <a href="/tag/php-2">php</a>
    <a href="/tag/server-2">server</a>
    <a href="/tag/web-design">web-design</a>
</div>

the code…

<style>
.tag-list a {

    color: #FFF; 
    text-transform: uppercase !important;
    background:#444;
    padding: 4px 6px 4px 6px;
    -moz-border-radius:3px;
    border-radius:3px;
    font:.8em Helvetica,Arial,sans-serif;
    margin: 1px 0px 0px 0px!important;
    display: block
}
</style>

My goal is to get this list of links to LOOK like that except they should only be the width of the text + padding instead of the full width. I have tried wrapping each link in the div, wrapping the div around the block of links like I have in the code above, If I wrap EACH link in a seperate div and remove the display: block it will show them as the proper width for each link and each on a new line, the only problem with that is that the margin does not work to let me space them out top and bottom.

I’m sure this is a simple fix for someone who knows more about css

jsbin.com link

Thanks for any help

Desired end result something like this…
enter image description here

When adding float: left; clear: both; it makes my other divs show up under it like this…enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:44:39+00:00Added an answer on May 26, 2026 at 1:44 am

    These easiest thing to do would be at add a float property. This essentially shrink wraps elements. I’ve also added a clear property to get them to stack.

    .tag-list a {
        color: #FFF; 
        text-transform: uppercase !important;
        background:#444;
        padding: 4px 6px 4px 6px;
        -moz-border-radius:3px;
        border-radius:3px;
        font:.8em Helvetica,Arial,sans-serif;
        margin: 1px 0px 0px 0px!important;
        display: block;
        float: left;
        clear: both;
    }
    

    I believe this is what you want: http://jsfiddle.net/thnT8/

    Note: I’d encourage you to utilize better markup, such as an unordered list. Not only it is more semantic, but it would allow better hooks and avoid the use of floats.

    UPDATE

    Per the comments and my note above, here’s the code: http://jsfiddle.net/84g6Q/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to change the will_paginate links from the format of /list?page=1 to /list/page/1
I'm trying to read a list of items from a text file and format
I am trying to format some html output from my db using php and
I am trying to format some c# output so that a number always has
I am trying to put a list inside of a <div> so that I
I am trying to format some bad html to output into a pop window.
I am trying to format a string to display two columns for a high
I'm trying to format a string to give me 2 characters for a number,
I'm trying to format a literal control on a code-behind page: BillerLiteral.Text = <p
I am trying to format my code with textmate indent option . but textmate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.