user2351564
user2351564

Reputation: 33

Is there a way to change input type="text" to "date" using CSS only?

I'd like to replace though CSS the type of an input from input type="text" to input type="date". Does it possible? Thanks

Upvotes: 2

Views: 13428

Answers (3)

user8283153
user8283153

Reputation:

(Late for you, but could be useful for somebody else) I had to do the same for the mobile version of my website. I created 2 forms, one for big resolution screens and other for mobile. After the resolution becomes less than 600px width I hide the 1 form and display the 2nd (the second one is with changed types).

Upvotes: 0

iiic
iiic

Reputation: 1362

You may only change appearance of elements (not real type) by css3 appearance property. For example some text element into element button:

span
{
    -moz-appearance:button;
    -webkit-appearance:button;
    appearance:button;
}

But list of possible values is limited. Still not chance to change input type="text into input type="date".

Upvotes: 1

Quentin
Quentin

Reputation: 944008

No.

CSS is a presentation language. It cannot be used to alter the semantics and structure of a document.

The closest you could come would be to determine which if a file and date input were visible in the document.

Upvotes: 9

Related Questions