Dimensions of HTML Container on Google Website

I'm attempting to incorporate a collapsible table using HTML Box in a Google site. The code for the collapsible table can be found at

http://tutorials.seowebpower.com/google-sites-advanced/collapsible-table
. Here is the code:

<html>
<head>
<style>
    .container {
        background-color:deepskyblue;
        width: 600px;
        height:50px;
        position: relative;
    }
    .title {
        font-size: 16pt;
        font-weight: bold;
        color: aliceblue;
        position: absolute;
        left: 20px;
        top:25%;
    }
    #opened {
        display: none;
    }
    .arrow-up {
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-bottom: 10px solid white;
    }
    .arrow-down {
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid white;
    }
    .arrow-up, .arrow-down {
        position: absolute;
        top: 40%;
        right:15px;
    }
    .hidden-content {
        margin:0 0 20px 0;
        padding: 10px 20px 10px 20px;
        border: 1px solid deepskyblue;
        border-top: none;
        background-color: aliceblue;
    }
</style>
<script>
    var collapse;
    var uncollapse;
    var turnOn = true;

     // Chrome Sites Fix
    var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

    function tempChromefix() {
        // To turn off set true to false
        if (turnOn == false && is_chrome) {
            document.getElementById("opened").style.display = "block";
            document.getElementById("closed").style.display = "none";
        } else {
            return false;
        }
    }

    function uncollapse() {
        document.getElementById("closed").style.display = "block";
        document.getElementById("opened").style.display = "none";
    }

    function collapse() {
        document.getElementById("opened").style.display = "block";
        document.getElementById("closed").style.display = "none";
    }
</script>
</head>

<body onLoad="tempChromefix()">

<table id="closed">
    <tr>
        <td>
            <div class="container" onclick="collapse()">
                <div class="title">Click to open drop-down</div>
                <div class="arrow-down"></div>
            </div>
        </td>
    </tr>
</table>

<table id="opened">
    <tr>
        <td>
            <div class="container" onclick="uncollapse();">
                <div class="title">Click to close drop-down</div>
                <div class="arrow-up"></div>
            </div>
            <div class="hidden-content">
                <h3>It works!</h3>
                <p>This content is to be hidden from the user until clicked.</p>
            </div>
        </td>
    </tr>
</table>
</body>
</html>

The issue I'm encountering involves the width of the table. I want it to expand to the maximum possible width depending on the screen size, whether on my MacBook or iMac. Using width: 100% should make the table inherit the parent's screen size. However, it seems that within an HTML Box, the different categories do not inherit the parent's attributes.

For instance, when I apply width: 100% in the .container section, it collapses to zero width instead of filling the entire screen.

Any assistance would be greatly appreciated!

--- Madhur

Answer №1

After experiencing the same problem, I found a solution that may seem counterintuitive at first. Simply hover over the HTML box and click on the "Align center" icon. Upon saving, you will notice that the elements expand to full width (at least in my case).

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

Undefined value is encountered when passing props through the Context API in a REACT application

Exploring My Context API Provider File (Exp file) import react form 'react'; import {createContext} from "react"; export const ContextforFile = createContext(); export function ContextData(props){ let rdata=props.data return( &l ...

Position the li elements within the ul at the bottom

I am trying to align a li element at the bottom of a ul list. +------+ | li1 | | li2 | | li3 | | | | | | | | li4 | +------+ Any suggestions on how to achieve this? MY ATTEMPTED SOLUTION: li4 { position: fixed; bottom: 0; } W ...

In Production environment, v-model triggers a ReferenceError

My Vue View includes the following code: <script setup> import Overwrite from "../components/Overwrite.vue"; </script> <template> <div> ... <textarea v-model="text" cols="99" rows=&qu ...

Error: Primefaces ajax status failure (dialog has not been defined)

I incorporated the same code found on primefaces.org, specifically this link: http://www.primefaces.org/showcase/ui/ajaxStatusScript.jsf <p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/> <p:dialog modal="true" ...

Invoking a function containing an await statement does not pause the execution flow until the corresponding promise is fulfilled

Imagine a situation like this: function process1(): Promise<string> { return new Promise((resolve, reject) => { // do something const response = true; setTimeout(() => { if (response) { resolve("success"); ...

Utilize vue.js to cache and stream videos

I'm new to the world of vue.js and I'm facing a certain dilemma. I implemented a caching system using resource-loader that preloads my images and videos and stores the data in an array. Everything is functioning correctly, but now I'm unsur ...

REACT Issue: Unable to Select Dropdown Option with OnChange Function

I have a component that includes a select element. Upon clicking an option, the OnProductChange function returns the value. However, my e.target.value shows as [Object Object]. Yet, {console.log(product)} displays: {id: 1, name: "VAM"} Clicking on Add L ...

Retrieving a designated set of attributes for elements chosen using an element selector

Is there a way to retrieve specific attributes for the first 10 <p> elements in a document using jQuery? I know I can easily get the first 10 elements with $('p').slice(0,10), but I only need certain attributes like innerText for each eleme ...

Unable to process form submission using Ajax in ASP.NET MVC

I'm having trouble with submitting a form using ajax and opening a modal dialog after the ajax function is successful. Whenever I click the submit button, the process doesn't complete. Where could the issue be, in the ajax method or somewhere el ...

Generate a fresh array using the data from the existing array object

I have nested objects within arrays that I need to manipulate. { "page": [ { "num": "1", "comp": [ { "foo": "bar", "bar": "foo", ...

Encountering a problem when trying to utilize material-ui icons in a React application

After installing the Material-UI core and icons packages using npm install @material-ui/core and npm install @material-ui/icons in my React app, I tried to use the FileUploadIcon. Here's how I imported it: import { FileUploadIcon } from '@materia ...

Achieving Vertical Alignment of Text with CSS

Can you figure out what's wrong with the placement of content outside the <footer> tag in this HTML? Also, why is the text not perfectly vertically middle-aligned? <html> <head> <style> body { ...

Strategies for handling user typos in a JavaScript prompt

Hi there! Just wanted to say that I'm new to this website, so please forgive any posting mistakes I might make. I'm currently taking a web technology class where we're learning JavaScript. In a previous lesson, we covered HTML5 and CSS. Our ...

Recursion using Node.js Promises

I'm facing some difficulties while iterating through my Promises and completing my parser code: let startFrom = 0, totalRecords = 10000, doneRecords = 0 const rows = 10 const parserRequests = function () { if (startFrom <= totalRecords) { ...

implementing ko.renderTemplate in a custom binding

I am interested in using named templates with a custom bindingHandler in knockout, but I have encountered an issue where the viewModel passed into the custom binding does not include the context properties of $root, $parent, $component, etc., which are nec ...

What is the proper way to utilize a variable within the translate3d function?

Currently, I am developing my portfolio and working on a function in JavaScript called translate3d(0,10px,0). My question is, how can I use a variable instead of hardcoding the value 10px? I attempted to use translate3d(0,a,0) where 'a' is a vari ...

What is the purpose of enclosing an Angular app within a function?

As I delve into learning Angular, I've encountered a recurring snippet in the app.js file across various resources: (function () { \\\myAngularModules })(); Despite its prevalence, the explanation provided is often just ...

Facing unexpected behavior with rxjs merge in angular5

import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/merge'; this.data = this.itemsCollection.valueChanges() this.foo = this.afs.collection<Item>('products') .doc('G2loKLqNQJUQIsDmzSNahlopOyk ...

Utilize CSS styling for elements persistently, even following a postback event triggered by

In my asp.net app, I have multiple hrefs with dynamic Ids that all share the same CssClass called MyClass. I am looking to hide these buttons based on a certain condition. Initially, I used the .ready function: $(document).ready(function() { if(condit ...

What are the steps to resolving an Unhandled promise rejection error in a Node.js application?

I encountered an error message that I need help resolving: I am faced with an unhandled promise rejection. This issue likely occurred due to throwing inside an async function without a catch block, or rejecting a promise without handling it using .catch( ...