Is there a way to style a readonly input to look like a block level element while maintaining its automatic width adjustment? Setting the width to 100% is not the desired solution.
Here is the CSS code that I have tried:
input:read-only, textarea:read-only {
border: 0;
outline:0;
height: auto;
text-indent: 0;
width: auto;
margin-left: 10px;
float: left;
margin-bottom: 7px;
font-weight: 300;
display:block;
}
My goal is to make the input field behave like the following HTML structure:
<div>
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9deef2f0f8f2f3f8ddeef2f0f8f1f2f3faf9f2f0fcf4f3fff8fefce8eef8eaf5e4f3f2e9b3fef2f0">[email protected]</a>
</div>
There seems to be an issue with the input field's default width, which affects how it is displayed. I have also tried using the overflow property without success.
I prefer to find a CSS-only solution for this and avoid using JavaScript.
For an updated demonstration, you can view it here: http://jsfiddle.net/hhz17uww/6/