0

I have a HTML setup of the following:

<p class="vcard contact" role="contentinfo">
 <a class="org url organization-name" href="url" title="organization">organization</a><br>
 <span class="fn">name</span><br>
 <a class="tel" href="tel:tel">tel</a><br>
 <a class="email" href="mailto:email">email</a>
</p>

What CSS would I apply to make this columned? Organization and name on the left and tel and email on the right for example.

I could change the HTML, but I want it to be modular and keep HTML and CSS strictly separated.

2
  • Maybe mark it up as an unordered list and float the list elements? Pure CSS columns are tricky at the moment, depending on what you need/want to support. Commented Oct 13, 2013 at 10:47
  • 1
    Maybe like this? Commented Oct 13, 2013 at 10:53

4 Answers 4

1

Check this fiddle

.vcard
{
    position:relative;
}

.organization-name
{
    position:absolute;
    top:0;
    left:0;
}

.fn
{
    position:absolute;
    top:20px;
    left:0;
}

.tel
{
    position:absolute;
    top:0;
    left:50%;
}

.email
{
    position:absolute;
    top:20px;
    left:50%;
}
Sign up to request clarification or add additional context in comments.

Comments

1

Do you just mean how to make columns? You could change the order a little and make all elements blocks, then float them so each element inside vcard takes up 50% width.

Removing the line breaks would also make it easier to manipulate with css

.vcard a, .vcard .fn {
    display : block;
    float : left;
    width : 50%;
}

http://jsfiddle.net/mickadoo/zSytv/

1 Comment

I guess changing the order is unavoidable. Gah, if only design would be really left to CSS only...
0

Using <table>,<td>,<tbody>,<thead> and more. Read: http://www.w3schools.com/html/html_tables.asp

Comments

0

http://jsfiddle.net/DzucC/4/

.col1 { float:left; } .col2 {  float:left;
    margin-left:15px; }

<div>
    <div class="vcard contact col1" role="contentinfo">
     <a class="org url organization-name" href="url" title="organization">organization</a>  <br>
     <span class="fn">name</span><br>
    </div>
    <div class="col2">
        <a class="tel" href="tel:tel">     tel</a><br>
        <a class="email" href="mailto:email">email</a>
    </div> </div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.