1

I have created a Liferay 6.2 Layout having four rows in single column where portlets are placed. The layout rendered correctly but the issue is that I need the four rows to have different height such as 15%, 25%, 30%, 30% which makes 100%. Can we do this at the layout side itself, so that it can be generic wherever I use this Layout

Can anyone please tell me how to do that

I am using Bootstrap 2.3.2

What I am trying to achieve is something like this as shown below

enter image description here

My liferay layout code is as given below

template.tpl

<div class="layout1template" id="main-content" role="main">
        <div class="portlet-layout">
            <div class="portlet-column portlet-column-only span12" id="column-1">
                $processor.processColumn("column-1", "portlet-column-content portlet-column-content-only")
            </div>
        </div>

        <div class="portlet-layout">
            <div class="portlet-column portlet-column-only span12" id="column-2">
                $processor.processColumn("column-2", "portlet-column-content portlet-column-content-only")
            </div>
        </div>

        <div class="portlet-layout">
            <div class="portlet-column portlet-column-only span12" id="column-3">
                $processor.processColumn("column-3", "portlet-column-content portlet-column-content-only")
            </div>
        </div>

        <div class="portlet-layout">
            <div class="portlet-column portlet-column-only span12" id="column-4">
                $processor.processColumn("column-4", "portlet-column-content portlet-column-content-only")
            </div>
        </div>
</div>

UPDATES

template.tpl

<div class="layout1template" id="main-content" role="main">
        <div class="portlet-layout">
            <div class="portlet-column portlet-column-only span12 row-one" id="column-1">
                $processor.processColumn("column-1", "portlet-column-content portlet-column-content-only")
            </div>
        </div>

        <div class="portlet-layout">
            <div class="portlet-column portlet-column-only span12 row-two" id="column-2">
                $processor.processColumn("column-2", "portlet-column-content portlet-column-content-only")
            </div>
        </div>

        <div class="portlet-layout">
            <div class="portlet-column portlet-column-only span12 row-three" id="column-3">
                $processor.processColumn("column-3", "portlet-column-content portlet-column-content-only")
            </div>
        </div>

        <div class="portlet-layout">
            <div class="portlet-column portlet-column-only span12 row-four" id="column-4">
                $processor.processColumn("column-4", "portlet-column-content portlet-column-content-only")
            </div>
        </div>
</div>

CSS

#main-content {
  height: 100vh;
}

.row-one {
  height: 15%;
}

.row-two {
  height: 25%;
}

.row-three {
  height: 30%;
}

.row-four {
  height: 30%;
}
Alex Man
  • 4,746
  • 17
  • 93
  • 178
  • 100 % of what? window height or `main-content` height? Did you already tried to find an answer, like [this one](http://stackoverflow.com/questions/18331716/css-position-with-percent/18331945#18331945)? – Tobias Liefke Dec 11 '15 at 07:56
  • @TobiasLiefke I have tried but did'nt work – Alex Man Dec 11 '15 at 10:17
  • You should always add things you have tried so far (and why it didn't work) to your question - otherwise it may get closed as duplicate. – Tobias Liefke Dec 11 '15 at 10:44
  • @TobiasLiefke Take a look at my updates I have tried that but did'nt worked – Alex Man Dec 11 '15 at 10:55

1 Answers1

1

You are defining height in a row that has a parent without height defined. The height works depending on the parent. So your html needs to be like this:

  <div class="layout1template" id="main-content" role="main">
        <div class="portlet-layout row-one">
    -------------------------------^^^^^^^
            <div class="portlet-column portlet-column-only span12" id="column-1">
                $processor.processColumn("column-1", "portlet-column-content portlet-column-content-only")
            </div>
        </div>
  </div>
Marcos Pérez Gude
  • 21,869
  • 4
  • 38
  • 69