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 9165901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:01:10+00:00 2026-06-17T15:01:10+00:00

I have a layout composed of divs displaying as table, 3 table rows, and

  • 0

I have a layout composed of divs displaying as table, 3 table rows, and up to 5 table cells per row. My problem is twlofold:
1) I can’t figure out how to center the table cells within the rows if there are less than five cells in the table., and
2) I can’t figure out how to keep the integrity of the shapes when there are less than 5 in a row.

The number of cells in a row will be variable (between 3 and 5), and I have to use divs — I can’t use real tables.

Here is a codepen: http://codepen.io/Jaemaz/full/aCboe

Here is the source:

HTML:

<div class="focus-container">
  <div class="focus-row">
    <div class="focus-element  circle">
      <span class="ng-scope">
        Option A
      </span>
      </div>
      <div class="focus-element  circle">
        <span class="ng-scope">
          Option B
        </span>
      </div>
      <div class="focus-element  circle">
        <span class="ng-scope">
          Option C
        </span>
      </div>
      <div class="focus-element  circle">
        <span class="ng-scope">
          Option D
        </span>
      </div>
      <div class="focus-element  circle">
        <span class="ng-scope">
          Option E
        </span>
      </div>
  </div>
  <div class="focus-row">
    <div class="focus-element  circle" ng-class="{unknown: unknown, square: square, circle: circle, selected: selected, shouldHaveBeenSelected: shouldHaveBeenSelected, shouldNotHaveBeenSelected: shouldNotHaveBeenSelected}" ng-click="click()" ng-transclude="" focuschoice="" identifier="F" enabled="true">
      <span class="ng-scope">
        Option F
      </span>
  </div>
  </div>
</div>

CSS:

.focus-container {
width: 560px;
height: auto;
display: table;
background-color: #000;
border-spacing: 15px;
table-layout: fixed;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
user-select: none;
}

.focus-row {
width: 100%;
height: 100%;
display: table-row;
}

.focus-element {
width: 90px;
height: 90px;
display: table-cell;
color: #fff;
background: #808080;
border: 2px solid #BFBFBF;
vertical-align: middle;
text-align: center;
font-family: "Ubuntu", Arial, Helvetica, sans-serif;
font-size: 14px;
text-shadow: 0px 2px 1px rgba(0, 0, 0, 1);
max-width: 94px;
}

.focus-element.circle {
-moz-border-radius: 94px;
-webkit-border-radius: 94px;
border-radius: 94px;
}

Screen Shot:
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-06-17T15:01:12+00:00Added an answer on June 17, 2026 at 3:01 pm

    Building on @Jojje ‘s suggestion, the answer lies in creating an extra “inner” level (display:table) within the div structure. Solution is on CodePen here: http://codepen.io/Jaemaz/pen/spbKf

    In case Codepen goes away, here is sample HTML and CSS:

    HTML

    <div class="focus-container">
      <div class="focus-row">
        <div class="inner">
          <div class="focus-element circle">
            <span>ahem</span>
          </div>
        </div>
      </div>
      <div class="focus-row">
        <div class="inner">
          <div class="focus-element circle">
            <span>hello</span>
          </div>
          <div class="focus-element circle">
            <span>there</span>
          </div>
        </div>
      </div>
      <div class="focus-row">
        <div class="inner">
          <div class="focus-element circle">
            <span>what</span>
          </div>
          <div class="focus-element circle">
            <span class="content">is</span>
          </div>
          <div class="focus-element circle">
            <span>happening</span>
          </div>
          <div class="focus-element circle">
            <span>happening</span>
          </div>
          <div class="focus-element circle">
            <span>happening</span>
          </div>
        </div>
      </div>
    </div>
    

    CSS

    .focus-container {
      width: 560px;
      background-color: #000;
      padding: 5px;
    }
    
    .focus-container .focus-row {
      height: 110px;
      background-color: #000
    }
    
    .focus-container .focus-row .inner {
      display: table;
      margin: 0 auto;
      height: 110px;
    }
    
    .focus-container .focus-row .inner .focus-element {
      float: left;
      text-align: center;
      margin: 0 auto;
      width: 94px;
      height: 94px;
      background-color: #009900;
    }
    
    .focus-container .focus-row .inner .focus-element span {
      margin-top: 40px;
      display: block;
    }
    
    .focus-container .focus-row .inner .circle {
      -moz-border-radius: 94px;
      -webkit-border-radius: 94px;
      border-radius: 94px;
      margin: 8px;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a two-column layout, composed of fixed-width floated divs. Inside the first column
I have a layout setup which can be view here: http://jsfiddle.net/Pn3ts/ It all works
I'm using Achartengine for Android, and i have layout composed by a ScrollView mother
In my project, i have a simple activity composed of a single XML layout
I have a customized ListView that each row of the list is composed by
I have a layout A composed by a set of 2 texts and one
I'm tired of trying to fix this but no luck. I have layout composed
I have a Layout containing a fragment. I set width of Layout to let's
I have this layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=wrap_content android:orientation=horizontal android:gravity=left> <LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal>
I have a layout like this in which I want to display a label

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.