Set Initial Height for Resizable Text Area with Large Initial Value - html

I have a text area element that I want to cap at an initial height of 168px that is expandable vertically but has an initial value that's large and is auto-expanding the box past that 168px initial height on page load. I want to be able to allow the user to be able to expand that box if they want to later on but initially on page load it should be set to 168px with the overflow from that initial value hidden. Have tried various combinations of min-height, resize: vertical, and overflow without success. The box is still autoexpanding as the initial value gets loaded into it on page load. Is this possible with CSS?

I guess, this code will work. Please share your code as a snippet, it would be easy to debug.
textarea{
resize:vertical;
min-height:168px;
}
<textarea></textarea>

Related

Autoscrolling text animation in CSS not going all the way

I'm trying to scroll some single-line labels in a single-line fixed-width container.
What I've tried so far is:
Create a container with fixed dimensions.
Place a scrollable container inside and attach the animation.
Place the labels.
The animation partially works, but the scrolling doesn't go all the way to what is configured (translateX(-100%)).
The overflowing part (green color in codepen) that exceeds the fixed container width is ignored.
I've tried various display and flex field combinations, but noting.
Here is a codepen sample.
https://codepen.io/efthymiosks/pen/QWQGVGg
The issue is that 100% is the size of the element, not the content. What I mean by this is because the content overflows the element, 100% only refers to the visible width of the container.
You need to change 100% to something else such as 150%. Unfortunately, this means that you need to know the width of the contents before. The only other way that I know of is using JavaScript to calculate the width of the contents.
Codepen

Cap element size to grid area when using align-item: start

I have a CSS grid with a scrollable element placed in one of the grid's areas.
What'd I'd like is for the item to shrink if the content is too small to fit the area. I did this by setting align-self to start.
This works great, until the content grows. The element resizes past the end of the grid area it's assigned to.
How can I use align-start but still cap the height to the height of the grid area? I would have expected this to be the default behavior.
One solution is to have the element stretch but then have a child element inside it that contains the actual content. The parent would have overflow: auto and the child would simply grow until it's too large for the container. Unfortunately, this kills the box-shadow.
I could put the box-shadow on the outer element in this case, but then it'll be too large when the content is small.
Any ideas what I can do here? I considered using some Javascript shinnanigans but I'm not even sure how I'd grab the height of the grid area from JS.
JSFiddle: https://jsfiddle.net/1kLenm5a/2/
Apparently max-height: 100% works. I could have sworn I tried that but I was messing with so many other settings at the same time I must have missed it.
Thanks.

How to restrict textarea height and disable rows expanding

I'm trying to fix a textarea height and disable ability to expand rows while typing. So please note that I'm not just trying to "hide" scrollbar, or to prevent user from being able to resize text area using mouse.
You can make it a div and apply "contenteditable" = true.
Relevant changes required are:
This contents of this column should always be visible i.e. no scroll bar, and instead the height of this row should adjust to show all content.
Possible solution to fix the problem with textarea would be to use javascript.

How to apply sliding effects with respect to panel width in gwt.?

I am working with panel sliding effects and stuck with situation like,
I have panel of width 150px with some content inside it, at some point if I reduce it's size by 70px for which I need to add sliding effect to that panel.
I wrote a code for this as,
VerticalPanel myPanel=new VerticalPanel();
myPanel.setWidth(150+"px");
// here I do some operations
myPanel.addStyleName("animated slideOutLeft");
myPanel.setWidth(80+"px");
when I reduce it's size it should automatically inherit "animated slideOutLeft" style with the inner content shown as it is. But in my case, "slideOutLeft" gets applied but inner contents doesn't remain visible and myPanel slidesOut.
It should slide out partially i.e. from 150px to 80px should be visible which is not currently taking place, instead it is sliding out full.
What is wrong in this.? How can I solve this issue.?
you can refer an example in https://agileui.com/demo/monarch/demo/admin-angular/index.html#/ where I want that same logoSliding at upper left corner effect which slidesIn and slidesOut.
When you reduce the width of a panel, children elements within that panel will reflow within the new width.
The example you point to hides some children elements when the panel's width is reduced.
So your code will work if the panel always contained children that fit within a smaller width. Alternatively, you can try setting overflow: hidden on your panel and settings children's width explicitly.
Long time ago I asked something similar. I would suggest you this topic in which you could find a possible solution combining percentage width and px min-width.

Creating a variable width <pre> element with optional scrollbars

I want to add div to my website which has variable width, and that it will display scroll bars when the width is smaller than the longest line.
I tried wrapping such a fixed width element, in a variable width (100%) but that didn't work. I got the scroll bars on the entire page.
Any thoughts?
Thanks
Yaron
You can apply the overflow CSS property to the problematic div:
#problematic-div {
overflow: hidden;
}
This defines what happens to content that overflows the content area of an element. For the value scroll, user agents are supposed to provide a scrolling mechanism whether or not it is actually needed; thus, for example, scrollbars would appear even if all content can fit within the element box.
You can try some examples here.
Hope it helps.