CSS only has an effect on input text and not on text areas

Check out this jsfiddle: http://jsfiddle.net/2GpmW/

When setting the CSS for the form elements, the following styles were applied:

.inputForm input[type="text"], .inputForm input[type="email"], .inputForm textarea, .inputForm select {
    border: none;
    color: #525252;
    height: 30px;
    line-height: 15px;
    margin-bottom: 10px;
    margin-right: 6px;
    margin-top: 2px;
    outline: 0 none;
    padding: 2px 0px 2px 5px;
    width: 400px;
    border-radius: 2px;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    background: #DFDFDF;
    font-family: inherit;
    font-size: inherit;
}

However, there seems to be an issue where the label next to the text area appears lower and the placeholder inside the text area is not vertically centered like in the input text field.

Could anyone shed light on why this is happening and provide a solution?

Thank you!

Answer №1

Ensure you include the following code:

textarea{
    vertical-align: top;
}

fiddle

The CSS property vertical-align determines how inline or table-cell elements are aligned vertically.

Answer №2

To center align, remember to include vertical-align:middle for both the textarea and label elements.

label, textarea{
  vertical-align: middle;
}

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

Undesirable flickering animation on button

Is there a way to display a dynamic button that follows the mouse cursor when hovering over an image? If you want to see the code in action, check out this codepen link. const box = document.getElementById("box"); function movebox(e) { box.style.lef ...

Tips for concealing a checkbox within the JS Tree Library

Is there a way to hide certain checkboxes generated by the JSTree library? Here is an example of the HTML structure: <div id="tree"> <ul> <li id="folder_1">Folder 1 <ul> <li id="child_1"& ...

The z-index property in jQuery dialog does not seem to function properly when used within an

When using bootstrap with jQuery dialog, I encountered a strange issue. If the z-index of the dialog is set to 1 or higher in a standalone script, everything works fine. However, when the same script is called inside an iframe, the dialog ends up appearing ...

Is there a way to create side-by-side Containers in Bootstrap?

Hello there! I have a question about my container setup. I really like how it looks, but right now it only displays one container on the right side. I actually want to show 3 containers side by side. Can anyone guide me on how I can achieve this? Wheneve ...

Can you identify the method used to apply CSS classes to an element?

Looking for clarification, I've noticed a pattern of "adding" (although unsure if that's the correct term) classes to elements in HTML UI frameworks. For instance, considering an element with these class attributes: class="mif-earth mif-2x" To ...

rearranging elements using CSS 2D transformations

While W3Schools offers a plethora of CSS3 information, I found there to be lacking in details about the placement of values within a 2D Transform matrix. Could someone please provide clarification on how each of the six parameters should be assigned? div ...

What could be causing the loading issues with my three.js examples?

After downloading Mr. Doob's three.js project, I noticed that the examples in the folder work fine if they don't involve a model or texture. However, the ones with models or textures appear blank for some reason. This issue perplexes me as I am a ...

Avoid using sticky positioning if the element exceeds the height of the screen

I have a sidebar that is set to be sticky, but in some cases it is taller than the height of the screen. If the sidebar ends up being larger than the screen height, I don't want it to stay at the top. Instead, it should scroll along with the content ...

Enhance the HTML content using a JavaScript function

Here is the code that I have: <label>Brand</label></br> <select name="brand" id="brand" onChange="changecat(this.value);"> <option value="" selected>Select Brand</option> <option value="A">AMD</option&g ...

Adding Custom CSS File to an iFrame in Angular

Currently, I am attempting to include a CSS file in a third-party iframe to modify its styling. My initial idea was to employ the following code snippet: ngOnInit() { ... this.myIframe.nativeElement.document.head.appendChild('style.css') } U ...

Creating flexible layouts with CSS grid that adjust dynamically based on the content

I want to utilize CSS grid to create a unique table design. The layout can be described as follows (refer to the image for visualization): https://i.sstatic.net/vj8iF.jpg Here's what I need: the header cell should have a size of 2x / 2y, while each h ...

tips for aligning the bar in Ion-toolbar

I've exhausted all options in trying to center the bar in ionic, but nothing seems to be working. Can anyone provide a solution? I want the bar to stay in the middle so that it remains centered when the application is downloaded on different devices ...

Progress bar arrows undergoing transformation in shape

I am currently developing an angular application where I have implemented a progress bar. The CSS code I have used is: CSS: .progressbar { height: 56px; background: lightgray; box-shadow: inset 0px -2px 5px rgba(0, 0, 0, 0.5); anim ...

Is there a way to use JavaScript to import several custom fonts at once?

Is there a way to import a long list of custom fonts as icons using Javascript? I have been obtaining the font list from an API, but importing them one by one with pure CSS using @font-face is time-consuming and difficult to maintain. @font-face { fon ...

Struggling to line up text and image next to each other?

I have inserted an image and some text. The text consists of 1 <h6> tag and 2 <p> tags. I attempted to use the float:left property, but the content did not display side by side as intended. Here is the code from content.js: <div className ...

Styling an Angular2 Component with a jQueryUI element

My goal is to integrate a jQueryUI range slider into an Angular2 Component. doubleRange.ts: /// <reference path="../../../../../typings/jquery/jquery.d.ts" /> /// <reference path="../../../../../typings/jqueryui/jqueryui.d.ts" /> import { Com ...

Unable to Publish HTML File

I am stumped as to why this particular file is not getting posted. Despite my thorough search for solutions, I have yet to pinpoint the issue. All the necessary ini file variables seem to be in order and I have verified the correct form type. Additionally, ...

Guide to inserting a dynamic hyperlink using jQuery

Utilizing jQuery's getJson method, I am fetching a JSON object and aiming to showcase it on an HTML page. I successfully display the data using this code snippet: $.getJSON(full_name, {}, function(data) { $.each(data, function(index, field) ...

Aligning a text box horizontally with a label when they are in separate div elements

I need help aligning a series of text boxes with their corresponding labels. The challenge is that they are in separate divs, preventing the use of the inherit keyword. I attempted to align them using javascript/jquery code below, but $(tb).css('left& ...

Implementing flickity with bootstrap 4 to create a seamless horizontal scrolling experience for cards that adjusts to different

Could anyone share a sample of successfully implementing flickity inside bootstrap 4? I am attempting to create a horizontal list of cards in a carousel format, where I can scroll through three at a time. I found using flickity intriguing, but I've en ...