Interested in providing placeholder with 2 distinct colors?

Is it possible to change the color of a placeholder text to two different colors? Let's take a look at the code:

<input type="text" 
       class="form-control setting-form" 
       id="inputDefault2" 
       placeholder="http://blabbr.im/#itsmynewawesomechat">

I would like to style "blabbr.im/" with the color rgba(255,255,255,0.3) and "#itsmynewawesomechat" with the color rgba(255,255,255,1)...

Answer ā„–1

Styling a placeholder with two different colors is not supported. However, you can achieve a similar effect by styling both the <label> and <input> elements to appear as if they are one unit (or any other tag like a <span>).

label, input {
    background-color: #4679BD;
    border: 1px solid #567890;
    float: left;
    font-family: sans-serif;
    font-size: 14px;
    line-height: 1.4;
    padding: 2px 5px;
}

label {
    border-radius: 2px 0 0 2px;
    border-right: 0;
    color: rgba(255,255,255,0.3);
    padding-right: 0;
}

input {
    border-radius: 0 2px 2px 0;
    border-left: 0;
}

::-webkit-input-placeholder {
    color: rgba(255,255,255,1);
}

:-moz-placeholder {
    color: rgba(255,255,255,1);
}

::-moz-placeholder {
    color: rgba(255,255,255,1);
}

:-ms-input-placeholder {  
    color: rgba(255,255,255,1);
}
<div>
    <label for="hashtag">http://blabbr.im/</label>
    <input id="hashtag" type="text" placeholder="#itsmynewawesomechat"/>
</div>

Answer ā„–2

When it comes to customizing the placeholder style, you have a few options:

    ::-webkit-input-placeholder {
   color: blue;
}

:-moz-placeholder { /* Works in Firefox 18 and below */
   color: blue;  
}

::-moz-placeholder {  /* Works in Firefox 19+ */
   color: blue;  
}

:-ms-input-placeholder {  
   color: blue;  
}

If you want to target your second input specifically, consider using its ID or the nth-child() selector.

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

Changing the color of a div through animation

Similar Question: jQuery animate backgroundColor I am looking to make a div shine or switch colors to signal to someone that they have gotten a message. What is the best way to animate the background color of a div for this purpose? ...

Issues encountered while sending HTML Form data to MySQL with Node JS

I have been experimenting with a basic html form to mysql using nodejs, but unfortunately it is not functioning as expected. The HTML file is named index.html and the Node.js file is called test.js. Below you can find my code: My HTML <!DOCTYPE html&g ...

Emphasize the selected item using the same style as the one that was dragged or clicked

Imagine a scenario where there are numerous items, each labeled with a specific class. There may be multiple items sharing the same class. If a user clicks or drags an item, I want all other items with the same class to be highlighted as well. I am looki ...

Ways to speed up the disappearance of error messages

There is a minor issue that I find quite annoying. The validation error message takes too long (approximately 3 seconds) to disappear after a valid input has been entered. Let me give you an example. https://i.sstatic.net/8UKrm.png Do you have any tips o ...

Ways to replace inline styles with print CSS?

While inline styles are often considered "evil", can they still be inserted into HTML using JavaScript (such as jQuery animation)? ...

The condition for "Else" always remains untouched

This snippet is a segment of my partial view content - <div class="form-group row"> <label for="email" class="col-sm-2 form-control-label">Email address</label> <div class="col-sm-9"> <input type="email" class=" ...

Effortless jQuery Parallax

Seeking assistance with debugging this jQuery code that manipulates the top margin of an element within a container. The container has a fixed size and overflow set to hidden to create a parallax effect. The parallax effect is functioning properly, but it ...

Is it feasible for nested div to remain unaffected by bleeding when the container is positioned relatively and has an overflow hidden

Is it possible to bleed a nested div even when the container is positioned relative with hidden overflow? In this case, giving the nested div a fixed position is not an option. Please check out this unique example: http://jsfiddle.net/s7nhw/11/. If you ...

CSS styles are not getting rendered by Firefox when loading content using jQuery AJAX

My website allows users to comment on books and articles, with a search input to find relevant sources. Using jQuery, I dynamically load new sources from an outside site based on search terms and display them in a list using AJAX. However, Iā€™m facing two ...

The arrow extends just a hair below the boundaries of the div, by approximately 1 pixel

I am facing an issue with my nav bar code. In Firefox and Chrome, everything works perfectly fine - there is a small arrow displayed below the links when hovered over. However, in Internet Explorer, the arrow appears slightly below the div, causing only pa ...

Achieving a 100% width input with Flexbox: Tips and tricks for success

Check out this flexbox form I created using bootstrap 4: https://jsfiddle.net/kkt0k2bs/1/ I have implemented a media query to adjust the form elements for smaller screens. For larger displays, I want the form items to be displayed inline. However, on sm ...

Using CSS selectors in Framework7 Vue allows for precise targeting and styling

I am currently working on developing a Cordova/Phonegap application using vue.js and the Framework7. I have been able to utilize functions like "onClick" by using the "v-on:click="OnClick" attribute within an HTML element. It's worth noting that Frame ...

The Outer Div Can't Contain Google Maps

I am currently working on integrating a map widget into a dashboard I created using gridstack.js. The sample widget layout that I am aiming for can be seen in the link below: https://i.sstatic.net/ZQP6G.png My goal is to embed the map within the inner (w ...

Is the embedded audio player not showing up on the screen?

I've been trying to add music to my blog page using the Billy audio player. I have successfully done this in the past, but for some reason, the player is not appearing on the finished page (I checked on both FireFox and Google Chrome) and I can't ...

Modifying a leave transition in Vue.js dynamically following the completion of an enter transition

I am dealing with a dynamic transition for a slider element that moves left or right. Vue only allows me to have one transition, so I am using a dynamic transition property like this: <transition v-bind:name="'slider-' + slideDirection"> ...

What is the best way to make an image in a slider overlap a following div?

I've been struggling to make the images on the right side of the slider overlay the div underneath it. I've experimented with different position and z-index values, but nothing seems to work. Check out the live site here This is what I currentl ...

Styling certain UL and LI elements with CSS properties

Greetings everyone! I constantly struggle when it comes to making my CSS cooperate. I have some code that involves using ul and li tags. However, I only want to apply that styling to specific sections of my HTML code rather than all instances of the ul and ...

What is the best way to merge two objects in a JSON array and separate them with a comma?

Hey there, I could use some assistance with formatting a code snippet. I have written JavaScript code to parse JSON data which includes latitude and longitude information: const api_url = 'json.php' async function getjsonlatest() { const resp ...

CSS may occasionally fail to load correctly when the page is first opened

At times, I have noticed that the header of my website does not display correctly when the page initially loads. Issue: In the screenshot provided, you can see that the headings appear within the black horizontal line. image link here http://techboy.co. ...

When you click on the link in AngularJS, it will automatically open the textarea for you

I am aware of the function in CSS called "target" that changes the URL address. However, I need to achieve this effect without changing the URL. My main question is whether I can accomplish this using AngularJS. If so, could someone please explain how to a ...