Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container">  
<input type="text" autocomplete="off" id="text" class="text-input" placeholder="Я расту в ширину" />

<button class="btn" id="more-text-btn">
  Добавь много текста

<button class="btn" id="less-text-btn">
  Добавь мало текста



                .container {
  width: 500px;
  margin: 30px auto;

.text-input {
  font-size: 24px;
  font-family: Arial;
  border-radius: 8px;
  resize: none;
  padding: 5px;
  overflow: hidden;
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  width: 400px;
  min-width: 400px;
  margin-bottom: 15px;
  &:focus {
    outline: none;

.btn {
  border: none;
  padding: 10px 15px;
  margin-right: 15px;
  curosor: pointer;
  color: #fff;
  border-radius: 3px;
  background: #428BCA;


                function addMoreText() {
  setValue("Съешь еще этих мягких французских булок, да выпей чаю. Съешь еще этих мягких французских булок, да выпей чаю");

function addLessText() {
  setValue("Однострочное предложение");

function setValue(text: string) {
  const textInput = document.getElementById("text"); = 0;
  textInput.value = text; = textInput.scrollWidth + "px";

//Получаем DOM-элементы
const buttonMore = document.getElementById("more-text-btn");
const buttonLess = document.getElementById("less-text-btn");
const textInput = document.getElementById("text");

//Обработчики событий
buttonMore.addEventListener("click", addMoreText);
buttonLess.addEventListener("click", addLessText);

textInput.addEventListener("input", (event) => { =  0; = textInput.scrollWidth + "px";