Unable to apply height and width properties to CSS div

I've been facing an issue with applying height and width to div elements in my project. The tech stack I'm using includes TailwindCSS and Nextjs.

My objective is to create vertically snap-scrolling slides, but the height and width properties seem to be getting stripped out in the browser rendering.

If anyone has any suggestions or solutions, please help as I'm running out of options.

Here's a snippet of the CSS code for both the container and each view:

  .snap-container {
    overflow-y: scroll;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-flow: column nowrap;
  }
  .snap-view {
    height: 100vh;
    width: 100%;
    display: flex;
  }

https://i.sstatic.net/KdDNN.png

Answer №1

suppose you possessed

.snap-container {
    overflow-y: scroll;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-flow: column nowrap;
  }
  .snap-view {
    height: 100vh;
    width: 100%;
    display: flex;
  }

both sets of your styles will be implemented, even if the image displayed only features the .snap/view

however, the browser omits the height and width properties.

this occurs because there are additional properties surrounding the code snippet provided that could have been overwritten due to cascading effects

if you desire the .h-screen and .w-full properties to persist, consider inserting them directly into the element or placing them in the CSS after the .snap-container and .snap-view

give that a try, hoping I've been of assistance

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

Incorporating a JavaScript variable into an inline HTML onclick event

Having trouble passing a variable into an inline onclick function. I've tried researching and following suggestions from this link, but encountered errors (Uncaught SyntaxError: missing ) after argument list): pass string parameter in an onclick func ...

The Impact of Using Custom HTML Tags with AngularJS Directives

If I were to create a unique avatarDirective in AngularJS that is connected to an userEmail property on the scope. The directive would update this HTML … <avatarDirective userEmail="user.email" /> with a standard img tag that has its src attribut ...

What are some methods for identifying a single attribute element that is duplicated elsewhere on a webpage?

<html> <tr id="userman-orgchart-tree-node-9" class="fancytree-expanded fancytree-folder fancytree-has-children fancytree-exp-e fancytree-ico-ef"> <td> <span class="fancytree-node" style="padding-left: 16px;"> <span class="fancytr ...

Unable to display PHP response in a div using AJAX - issue persisting

Hey there! I'm currently working on a project where I want the form submission to load a response into a div without refreshing the page. I've looked at various examples of ajax forms with PHP online, but haven't been able to solve my issue ...

Encountered a glitch during the npm installation process for mui core

I recently set up a new create-react-app and am still encountering the same error message. After installing MUI, I'm getting an 'unable to resolve dependency tree' issue. npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve depende ...

Issue with Translate3d functionality in fullpage.js not functioning as expected

Currently, I am in the process of constructing a website using fullpage.js with WordPress. Everything is functioning well except for one issue - when attempting to disable the plugin by using destroy() or changing setAutoScrolling to false, the translate3d ...

Identify when a browser tab is closed and determine which specific tab out of all the open tabs was closed

Is there a way to identify when a browser or tab is closed in Angular/JavaScript? I would like to know if there are specific events that can be used for detecting these actions. Any advice, information, or code examples on this topic would be greatly app ...

Stopping background content from scrolling while using position: fixed

Is there a way to prevent content from scrolling behind a fixed position element? Check out the demo here .navbar-default { background-color: #4c68f9; margin-bottom: 0; border: none; } .navbar-default.affix { background-color: #4762ed; margin ...

What is the correct way to place an item within a grid layout?

My current layout is structured with a single row class and two columns using the bootstrap grid system. However, I am facing an issue where I need to add another item within that grid system, but I am struggling to position it correctly. It keeps appeari ...

Decrease the size of the hyperlink area to only the center portion of the text for a more precise click target

Normal text links are present: <a href="projects.html">Projects</a> Is it feasible to make only the middle part of the letters clickable? Such as excluding the top of 'P' or the bottom of 'j'? a { font-size: 50px; ...

Displaying JavaScript Countdown in PHP Table

I have a database table with multiple fields and I am looking to create a countdown using the integer value from one of the fields (in minutes). How can I loop through and display the countdown for each row in a PHP table utilizing these values, with the a ...

Issue encountered following deployment of Strapi 4.23.0 to Google App Engine using a PostgreSQL database

I've encountered an issue while trying to deploy my Strapi application on Google App Engine. After deployment, I see the following error in the logs: Error: ENOENT: no such file or directory, mkdir '/workspace/.tmp' at Object.mkdirSync (nod ...

Creating a Vue component that generates multiple table rows

I am working on returning two tr elements from a single component called v-design-row. Vue typically requires template elements to be enclosed in a div, but due to the required tag structure of HTML tables, I am unable to wrap them within a div. Whenever I ...

Focusing in on a PARTICULAR SECTION of the picture

My website has a unique concept - comparing two articles side by side. One of the articles is mine, while the other is displayed alongside it. To capture entire pages for comparison, I utilize Google's GoFullPage feature to take screenshots. The goa ...

Is there a setting causing Webpack to not rebuild when there are changes to the CSS?

I have configured postcss-loader and style-loader on webpack, and I am using webpack-dev-server. However, every time I make changes to the CSS, webpack does not rebuild automatically. The script for webpack dev server that I use in npm scripts: webpack-d ...

Animate CSS during page load

Currently, I am implementing AJAX to dynamically load pages on my website. During the loading process, I wish to incorporate a spinning animation on the logo to indicate that content is being fetched. The jQuery script (although I'm still learning an ...

What could be causing appendChild to malfunction?

I'm having an issue trying to create three elements (parent and one child) where the third element, an <a> tag, is not appending to modalChild even though it's being created correctly. modal = document.createElem ...

Transform geojson data into an HTML table

As someone new to JavaScript, I am trying to figure out how to populate a HTML table with geojson entries like "ename" etc. Here is my current code: <table id="jsoncontent"></table> <script type="text/javascript"> window.onload = fu ...

What methods can be used to cloak JavaScript functions from the end user?

Looking to utilize jQuery AJAX calls? Here's an example: function addNewTeacher(){ $.ajax({ type: "POST", url: "/actions/dboss/newteacher.php", data: "uname=" + $("#newteacheruname").val() + "&upass=" + $("#new ...

Is it possible to use Google to search for specific HTML elements, or is there another method to identify elements without needing to provide the URL?

Can Google be used to search for specific elements? Is there a way to identify elements without needing the URL? An extensive search to locate elements. Example: I am trying to find websites that contain this particular class: .main-category-box.catego ...