The height of the content in the polymer core-scaffold cannot be set to 100%

I am working with a polymer element that I have defined. The main objective is to make the conversation_container element have a height of 100% so that the message_box_container can be positioned at the bottom of the entire panel using position: absolute; bottom: 0;. However, I am having trouble getting the parent element (conversation_container) to have a height of 100%. It seems like it should be simple, but for some reason, it's not working as expected. There might be an issue with the scaffold or I could be overlooking something obvious.

<polymer-element name="messenger-element">
<template>
    <style>
        :host {
        width: 100%;
        height: 100%;
        }
        #container{
        height: 100%;
        }
        #core_header_panel {
        background-color: rgb(255, 255, 255);
        }
        #core_toolbar {
        color: rgb(255, 255, 255);
        background-color: rgb(79, 125, 201);
        }
        #core_menu {
        font-size: 16px;
        }
        #paper_fab {
        position: absolute;
        bottom: 20px;
        right: 20px;
        }
        #input_container {
        bottom: 0px;
        width: 100%;
        position: absolute;

        }
        #message_box_container{
        padding: 10px;
        }

        #conversation_container{
        position: relative;
        }
    </style>
    <div id="container">
        <core-scaffold>
            <core-header-panel mode="seamed" id="core_header_panel" navigation flex>
                <core-toolbar id="core_toolbar"></core-toolbar>
                <core-menu valueattr="label" id="core_menu" theme="core-light-theme">
                    <core-item id="core_item" icon="settings" label="Item1" horizontal center layout></core-item>
                    <core-item id="core_item1" icon="settings" label="Item2" horizontal center layout></core-item>
                </core-menu>
                <paper-fab icon="add" id="paper_fab"></paper-fab>
            </core-header-panel>
            <div tool>Messenger</div>
            <div id="conversation_container">
                <div id="message_box_container" horizontal center layout>
                    <paper-input label="Enter a message" id="paper_input" flex></paper-input>
                    <paper-icon-button icon="send"></paper-icon-button>
                    <paper-shadow z="1"></paper-shadow>
                </div>
            </div>
        </core-scaffold>
    </div>
</template>
<script type="application/dart" src="messenger-element.dart"></script>

Answer №1

Not entirely sure if I understood your question correctly, but here are the modifications I made to ensure it functions properly:

To ensure the content fits within the main area, I utilized the fit attribute.

 <div id="conversation_container" fit>

Following that, in the CSS:

 #input_container {}
 #message_box_container{
   padding: 10px;
   border-style: solid;
   border-width: 5px;
   position: absolute;
   bottom: 0px;
   width: 100%;
 }
 #conversation_container{
   border-style: dotted;
   border-width: 2px;
 }

I included borders to clearly distinguish its boundaries.

Answer №2

Is it permissible to utilize core-drawer-panel and core-header-panel in place of the core-scaffold element? If so, here is a resolution that excludes CSS for positioning. It relies solely on polymer layout attributes. Below is the link to the jsfiddle snippet:

http://jsfiddle.net/kreide/jebczmkr/

<link rel="import" href="http://www.polymer-project.org/components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="http://www.polymer-project.org/components/core-scaffold/core-scaffold.html">
<link rel="import" href="http://www.polymer-project.org/components/core-header-panel/core-header-panel.html">
<link rel="import" href="http://www.polymer-project.org/components/core-toolbar/core-toolbar.html">
<link rel="import" href="http://www.polymer-project.org/components/core-item/core-item.html">
<link rel="import" href="http://www.polymer-project.org/components/paper-fab/paper-fab.html">
<link rel="import" href="http://www.polymer-project.org/components/paper-input/paper-input.html">
<link rel="import" href="http://www.polymer-project.org/components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="http://www.polymer-project.org/components/paper-shadow/paper-shadow.html">
<polymer-element name="my-element">
  <template>
    <style>
      [drawer] {
        box-shadow: 1px 0 1px rgba(0, 0, 0, 0.1);
      }
      [main] {
        height: 100%;
      }
      #core_header_panel {
        background-color: rgb(255, 255, 255);
      }
      #core_toolbar {
        color: rgb(255, 255, 255);
        background-color: rgb(79, 125, 201);
      }
      #core_menu {
        font-size: 16px;
      }
      #paper_fab {
        position: absolute;
        bottom: 20px;
        right: 20px;
      }
      #message_box_container {
        padding: 10px;
        border-style: solid;
        border-width: 5px;
      }
      #title {
        color: white;
        background-color: rgb(82, 110, 156);
      }
      #conversation_container {
        background-color: rgb(238, 238, 238);
      }
    </style>
    <core-drawer-panel transition id="coredrawerpanel" touch-action fit>
      <section drawer>
        <core-header-panel fit mode="seamed">
          <core-toolbar id="core_toolbar"></core-toolbar>
          <core-menu valueattr="label" id="core_menu" theme="core-light-theme">
            <core-item id="core_item" icon="settings" label="Item1" horizontal center layout></core-item>
            <core-item id="core_item1" icon="settings" label="Item2" horizontal center layout></core-item>
          </core-menu>
          <paper-fab icon="add" id="paper_fab"></paper-fab>
        </core-header-panel>
      </section>
      <section main>
        <core-header-panel fit mode="seamed">
          <core-toolbar id="title">
            <core-icon-button id="menuButton" icon="menu" core-drawer-toggle/></core-icon-button> <span>Messenger</span>

          </core-toolbar>
          <div class="content" fit>
            <div id="conversation_container" vertical layout style="height:100%"> <span flex>Content</span>
              <div id="message_box_container" horizontal center layout>
                <paper-input label="Enter a message" id="paper_input" flex></paper-input>
                <paper-icon-button icon="send"></paper-icon-button>
                <paper-shadow z="1"></paper-shadow>
              </div>
            </div>
          </div>
        </core-header-panel>
      </section>
    </core-drawer-panel>
  </template>
  <script>
    Polymer('my-element', {});
  </script>
</polymer-element>

<body fullbleed>
  <my-element></my-element>
</body>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Display validation in HTML5 only when the form is submitted

Here is the code snippet I am referring to: <input required pattern="[0-9]{5,10}" oninput="setCustomValidity('')" oninvalid="setCustomValidity('Type something')" /> I'm looking for a way to remove o ...

Can Vuetify's grid system seamlessly integrate with the Bootstrap grid system?

According to information from the Vuetify documentation: The Vuetify grid draws inspiration from the Bootstrap grid. It involves the use of containers, rows, and columns to organize and align content. If I utilize Bootstrap grid classes in a Vuetify pr ...

My custom Material UI table is being hindered by unnecessary div tags that are interfering with my CSS styling

View the generated code The rendered table demonstrates that when scrolling past the maximum width, the data does not appear <div> <table (not going to display all the markup for this. this table contains the headers of each column and appear ...

Using SQL to Insert Values into Select/Option

I am attempting to create a select form element with predetermined options. <select name="select1"> <option value="value1">Value 1</option> <option value="value2">Value 2</option> <option value="value3">Value 3 ...

Having trouble accessing an element using jQuery(idOfElement) with a variable as the name parameter

Possible Duplicate: Issue with JavaScript accessing JSF component using ID Whenever I attempt to retrieve an element by passing a variable in jQuery(idOfElement), it doesn't work. But if I use something like jQuery('#e'), it works perfe ...

What steps can be taken to properly display dateTime values in a data table when working with JavaScript (VueJS) and PHP (Laravel)?

I am facing an issue where I am unable to save user inputted date-time values from a modal into a data table. Despite receiving a success message, the dateTime values are not being added to the table. My payload only displays the state and approval fields ...

HTML DOM parser in PHP with simple space handling

Currently, I am utilizing PHP Simple HTML DOM Parser to extract text that lies between specific div tags using $html->find(div.divname) Everything runs smoothly until the divname contains a space. I've experimented with [div name] and "div name ...

Utilizing ionic-scroll for seamless movement and scrolling of a canvas element

I have set up a canvas element with a large image and I want to enable dragging using ionic-scroll. Following the provided example: <ion-scroll zooming="true" direction="xy" style="width: 500px; height: 500px"> <div style="width: 5000px; h ...

Combining mouse interactions with animated bar transitions

I want to create a graph with dynamic bar height transitions whenever it is drawn or redrawn. Once the bars are displayed, I would like mouse events (mouseenter, mouseleave, and mousemove) to trigger a tooltip showing information about the specific bar bei ...

Adjust header display for smaller screens

Looking for help with adjusting my header design on small screens: I want the search bar to go underneath on smaller screens, like this example: I've tried changing the position to relative at a certain screen width but it didn't work. <di ...

Issue observed in Angular Material: mat-input does not show background color when in focus mode

https://i.stack.imgur.com/eSODL.png Looking for a solution regarding the mat-input field <mat-form-field> <input class='formulaInput' matInput [(ngModel)]='mathFormulaInput'> </mat-form-field> The blue backg ...

Need to transfer a variable from the left side to the right side within Javascript. The instructor demonstrated using up and down as an

Recently started learning JavaScript as part of my college game programming course. I am only using Notepad for coding. Currently, I am trying to move an object (in this case, just the letter "o") from left to right on the screen. My professor has provided ...

Is there a way to format a block of text so that right-to-left text aligns to the right, while left-to-right text aligns

I have a content block that includes text in both left-to-right and right-to-left languages, and I need to ensure that both display correctly. If the user begins with left-to-right text, it should be displayed from left to right with left alignment If the ...

The <a> tag does not have the clickability feature

My personal website doesn't allow me to click on the links that I have added for web pages. Here is the CSS code I am using: @font-face { font-family: typewrite; src: url(fonts/typewcond_regular.otf); } @font-face { font-family: typewrite; sr ...

What could be the reason behind my code functioning properly on CodePen but not in my editor?

I'm currently using Sublime 3 for coding in HTML and CSS. After saving the files with the proper extensions, I included the Google Fonts to use the "Lobster" font. However, upon opening the .html file on Google Chrome, the Lobster font doesn't d ...

Aligning the 'container-fluid' slideshow and video player

I'm struggling to center a video in a slick slider that is set as a 'container-fluid'. The slideshow and video display fine across the full width of the browser, but when I resize the browser window or view the site on a lower resolution, I ...

What methods can be used to troubleshoot an issue of an AngularJS function not being called

I am facing an issue with a dynamic table I have created. The rows and action buttons are generated dynamically when the user clicks on the Devices accordion. However, there seems to be a problem with the function expandCollapseCurrent(). Whenever the use ...

Safari is experiencing issues with overflow-x functionality after a device rotation

I'm currently in the process of developing a website that requires a specific div element to be horizontally scrollable if its content exceeds the screen size. This functionality works smoothly on most browsers, except for Safari: Scenario: When the ...

Converting JSON data into an HTML table

I'm struggling to convert a JSON object into an HTML table, but I can't seem to nail the format. DESIRED TABLE FORMAT: Last Year This Year Future Years 45423 36721 873409 CURRENT TABLE FORMAT: Last Year 45423 This ...

Trimming content within an editable div in JavaScript: A guide

I am working on an editable div feature where users can input text for comments. My goal is to eliminate any unnecessary spaces before and after the text. For example, if a user types: "&nbsp;&nbsp;Hello&nbsp;world&nbsp;&nbsp;&nbsp ...