7

I'm following this guide on how to make a family tree using only CSS3. But I can't really get my head around how to make a marriage.

To clarify: What the codes does now is this: enter image description here

what i want to add is this: enter image description here

I know it's a simple question, but right now im stock

Chathuranga Chandrasekara
  • 20,548
  • 30
  • 97
  • 138
Michael Tot Korsgaard
  • 3,892
  • 11
  • 53
  • 89

5 Answers5

4

It appears someone has updated the original code to support husband/wife relationships. Good luck!

rookie
  • 2,783
  • 5
  • 29
  • 43
3

From the notes on the page:

"Note: I am working on a new version of this family tree which will have IE support to some extent and will have multiple parents to make it a practical solution for a family tree."

So it looks like 'multiple parents' aren't supported as yet.

Billy Moat
  • 20,792
  • 7
  • 45
  • 37
  • if you are interested in genealogy, fyi there is an effort to start a genealogy stackexchange.Help it reach beta: http://area51.stackexchange.com/proposals/43502/genealogy-family-history?referrer=DIRpC-2QEpSJcDcQkP0RAg2 It needs more high score people with stackexchange experience (as opposed to newbies like myself) – Duncan Sep 23 '12 at 12:48
3

What about just putting husband/wife in same li element and then using CSS to connect them? Something like this:

<style>
  .husband { float: left; }
  .wife { margin-left:10px; }
  .wife::before { 
    /* pseudo CSS, will need to be modified */
    content: '';
    position: absolute; top: 0; right: 50%;
    border-top: 1px solid #ccc;
    width: 50%; height: 20px;
  }
</style>


<li>
    <ul>
        <li>
            <a class="husband" href="#">Grand Child</a>
            <a class="wife" href="#">Wife</a>
            <ul>
               <li><a href="#">Kid</a></li>
               <li><a href="#">Kid</a></li>
            </ul>
        </li>
    </ul>
</li>
Brady Holt
  • 2,844
  • 1
  • 28
  • 34
2

Here's the approach I took

<li>
  <ul>
    <li>Father</li>
    <li>Mother</li>
  </ul>
  <a href="http://www.clarkeology.com/names/clarke/21/james">James CLARKE1779 - 1860</a>
  <div itemprop="spouse">
    <a href="http://www.clarkeology.com/names/cole/19/elizabeth">Elizabeth COLE 1794 - 1865</a>
  </div>
  <ol>
    <li><a>Child</a></li>
    <li><a>Child</a></li>
    <li><a>Child</a></li>
  </ol>
</li>

then any <li> throughout the tree can repeat like that (though if you add children AND parents to all of them you'd get a mess... generally just add one or the other once you get past the "core" person in that view.

Real example is on http://www.clarkeology.com with annotated css at /css/_tree.css and the code I wrote to parse a GEDCOM file and create the necessary html is at https://github.com/pauly/js-gedcom

I used itemprop instead of class above as I'm actually adding schema.org microformats to all mine too, but class would work just fine.

I really enjoyed the original css when I found it the other day, this has been fun to work on. Pull requests welcome on my code!

pauly
  • 21
  • 3
1

How about this?

<li>
    <ul>
        <li>
            <a href="#">Grand Child</a>
        </li>
        <li>
            <a href="#">Wife</a>
        </li>
    </ul>
</li>

So wrap the last grand-child into a ul. This gives you a line over the two, not in between but I don't think your box model allows for this right now...

Nebula
  • 1,045
  • 2
  • 11
  • 24
  • That would make the wife a sibling to the grand child. I need a way to get the wife "out of the system" and yet still connected to the husband – Michael Tot Korsgaard Aug 21 '12 at 09:34
  • 1
    A yes of course, I see... Trouble is that the connecting line are placed on the bounding boxes of the elements. That isn't possible on that spot. I began fiddling with a span to connect the grandchild-wife but that killed the line connecting grandchild to child. Structurally this _is_ correct however. You would start a new `ul` to indicate a new tree. It's the current CSS that doesn't play well with this concept. Like Quentin said: CSS isn't really intended for this... – Nebula Aug 21 '12 at 10:11