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

What is the process for linking a specific HTML file to a URL?

After preparing all my HTML, CSS, and JS files for upload to a server (I am using cPanel which I have experience with), I found myself wondering how to assign a specific HTML file to a custom link, such as "devwebdevelopment.com/about" I am looking to cre ...

Utilize a single submit button to navigate through multiple pages dynamically using JavaScript

I would like to navigate to different rooms with just one button using JavaScript. For instance, there are three rooms: "Kitchen, Toilet, and Bedroom". How can I utilize JS to enter any of these rooms based on my selection? If I input "kitchen" in the text ...

Troubleshooting Angularjs: Why isn't the HTML displaying the variable value?

Trying to display the value of an AngularJS variable in HTML using this code: <div ng-controller="MyTextbox"> <p>Last update date: {{nodeID1}} </p> Here's my angularjs controller code: angular.module("umbraco").controller("MyTex ...

"jQuery Hide-and-Seek: A Fun Way to Manip

I am facing a challenge with a set of divs that I need to dynamically show and hide based on user interactions with questions. Essentially, the user will be presented with a question. Based on their answer, specific content with a title and description wi ...

Generate a link to download a music or video file

I have an HTML file containing both video and audio files. I want to link these files, such as MP3 or MP4, using the <a href> tag to allow users to download them. The video and audio files are stored in the same folder as my HTML file. I have attemp ...

Creating visually appealing layouts with CSS floats and divs while ensuring responsiveness

As I work on bringing my vision to life, I'm experimenting with a mix of floats and divs, along with using a responsive image for the background and text. There's quite a bit involved in this process. 1. To start off, check out this example with ...

Placeholder disappears when text color is changed

I have been struggling for 3 hours trying to change the placeholder color to graytext, but it's just not working. Here is the code I've been using: <div class="form-group"> <label for="email">Email:</label ...

Ways to increase the font size of input text using bootstrap's css framework

I currently have a bootstrap textbox set up like this: <input type="text" class="span9" required name="input_text"/> My goal is to increase the height of my input box to 300px. The width, on the other hand, is being handled by span9. I utilized In ...

The NPM Install process seems to be skipping certain files that were successfully installed in the past

When I first installed NPM Install in a folder, it created multiple folders and files: node_modules public src .DS_Store package.json package-lock.json webpack.config.js After that, npm start functioned perfectly. Now, as I embark on a new project for th ...

What sets apart :first-child from :first-of-type?

I need help understanding the distinction between element:first-child and element:first-of-type Let's consider a scenario where you have a div element div:first-child → Refers to all <div> elements that are the first child of their parent. ...

Issue with NodeJS: The HTTP GET request is returning the code instead of the expected JSON object

My NodeJS code is designed to fetch a JSON object from a website. Here is the snippet: var http = require('http'); var url = { host: 'www.sample-website.com', headers: { "Accept": "application/json", 'Content-Type&apos ...

Error Encountered in jQuery UI SelectMenu

Struggling to integrate the jQuery UI SelectMenu, I keep encountering the same error in the browser console. Below is the HTML Code: <select name="files" id="files"> <optgroup label="Scripts"> <option value="jquery">jQuery.js</ ...

Click to add a card

Attempting to incorporate a new row with the click of a button dynamically has proven to be challenging for me. As someone who is relatively new to JavaScript, I am struggling to figure it out. In the demonstration provided below, you will notice that noth ...

What is the best way to align my content alongside my sidebar?

I am facing some challenges with my website layout because I used Bootstrap to integrate a sidebar. The sidebar has caused issues with the positioning of my content, and I'm struggling to align it properly next to the sidebar on the left side. Please ...

Style Vue slots one by one

I am a beginner delving into the world of vue (specifically, vue 2) and aiming to grasp the concept of utilizing slots in the most effective manner. Below is the code I'm working with: <template> <div> <button cla ...

Issue with transition on the second attempt

In this code snippet, I have managed to achieve my desired outcome but it seems to only work on the first run. I am not sure why this is happening, so if anyone can help me out that would be greatly appreciated. Here is a demo of the code in action: HTML ...

Creating a Mobile-Friendly Centered Navigation Bar with Scroll Functionality Using Bootstrap 4 Alpha 6

Currently, I am working with the standard Bootstrap navbar that has the class="justify-content-center". My goal is to make this navbar scrollable when the elements do not have enough space. The issue I'm facing is that I can only scroll to the right a ...

Animation that increments to a predetermined value

I'm trying to create a counter animation that dynamically animates a value calculated by the checkboxes selected. The calculation is working fine, but the animation is not happening. http://jsfiddle.net/dbtj93kL/ $('input[type="checkbox"]&apo ...

Text that appears automatically in an input field

I've searched high and low, but I just can't seem to find a solution that works for me. What I need is a way to automatically populate a HTML text field with default text when the page loads. This default text should ideally be a PHP variable and ...

The icons from Font Awesome are not displaying properly in Angular version 15

I have been searching for new information to help solve the error I am experiencing but haven't found any useful results. Here is my issue: I am working on a project in Angular 15.1.0 and want to incorporate some Font Awesome icons. To do this, I foll ...