Welcome Guest ( Log In | Register )



2 Pages V  < 1 2  
Reply to this topicStart new topic
> Css For Input Text Only, I don't think there is a solution but...
Hercco
post Dec 13 2005, 07:13 AM
Post #11


Super Member
Group Icon

Group: Members
Posts: 595
Joined: 4-September 04
Member No.: 228



QUOTE(vdhieu84 @ Nov 17 2005, 04:56 PM)
I searched the internet for the whole 3 days and read the CSS2 specification over and over again... and probably I have to admit that they don't support it (at least for now).
*



Yes they support it with attribute matching ( [type=text] ). Its just Microsoft that doesn't support this. By they way does anyone know if the new IE version will be compliant in this?

This post has been edited by twitch: Dec 20 2005, 09:02 AM
Go to the top of the page
 
+Quote Post
vdhieu84
post Dec 13 2005, 12:56 PM
Post #12


Member [ Level 1 ]
Group Icon

Group: Members
Posts: 32
Joined: 25-October 05
Member No.: 9,279



QUOTE(Hercco @ Dec 13 2005, 02:13 AM)
Yes they support it with attribute matching ( [type=text] ). Its just Microsoft that doesn't support this. By they way does anyone know if the new IE version will be compliant in this?
*



Oh well, that's very true. But the unfortunated fact is that 70% of the traffic accessing my websites are from users who use IE. And even the new version of IE released (I thought that it only compatible with the new OS), people not gonna update it soon :|.
Go to the top of the page
 
+Quote Post
twitch
post Dec 20 2005, 09:19 AM
Post #13


Veteran Nut
Group Icon

Group: Members
Posts: 527
Joined: 4-October 05
From: UK
Member No.: 8,895



You need to cheat the system, by using textarea.

You can use the textare just like the form input, but it allows you more control. And by simply using CSS to change the heigh, width and font styles of your textarea, you can do anything with it. Just remember to include overflow: hidden; so that none of the scrollbars show and you should be fine.

CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
textarea {
  height: 18px;
  line-height: 18px;
  overflow: hidden;
  width: 400px;
}
</style>
</head>

<body>
<form name="form1" method="post" action="">
<textarea name="textarea" cols="1" rows="1"></textarea>
</form>
</body>
</html>


Hope that helps wink.gif
Go to the top of the page
 
+Quote Post
Khymnon
post Jan 7 2006, 11:23 AM
Post #14


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 72
Joined: 1-January 06
From: Egypt
Member No.: 10,410



A brilliant idea, twitch. Absolutely brilliant. Two thumbs-up for that one.

Actually, as far as IE7 and Microsoft in general are concerned, they don't worry so much about compliance with the W3C standards, including CSS. I haven't read anything about CSS support in IE7, but I wouldn't count on it too much. Plus, basic tests show that this bad boy is going to be devilishly vicious on system resources, so I don't suppose many will use it until Microsoft works it out.

If you absolutely can't use attributes, then I believe there isn't a way to do what you want, except for going with twitch's idea.
Go to the top of the page
 
+Quote Post
mastercomputers
post Jan 7 2006, 11:38 AM
Post #15


PESTICIDAL MANIAC
Group Icon

Group: Members
Posts: 626
Joined: 1-September 04
From: Auckland, New Zealand
Member No.: 27



I'm just wondering why you're not using the width attribute in that element which isn't deprecated, it will be when XForms takes over HTML Forms though.

What your problem really seems to be though is the lack of standard support, although, using input { width: 400px; } will affect most input elements, where as input[type=text] would be more suited to what you want but the lack of support is the downfall.

The textarea solution seems alright, is it avoiding newline characters? Would it require javascript to take the event of the keypress if it's allowed to submit the default form button?


Cheers,


MC
Go to the top of the page
 
+Quote Post
iGuest
post Oct 16 2007, 02:13 PM
Post #16


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



There are two ways to do this. The first is the 'proper' syntax - the second requires a new class:

<STYLE type="text/css">

input[type=text] {
width: 300px;
background-color: cyan;
}

input.text {
width: 300px;
background-color: yellow;
}

</STYLE>

<FORM>
<input type="text"><br>
<input class="text" type="text"><br>
<input type="text"><br>
<input type="submit">
</FORM>
Go to the top of the page
 
+Quote Post
TavoxPeru
post Nov 17 2007, 05:12 AM
Post #17


Super Member
Group Icon

Group: [HOSTED]
Posts: 795
Joined: 8-April 06
From: Lima - Peru
Member No.: 12,579
myCENTs:26.78



QUOTE(FeedBacker @ Oct 16 2007, 09:13 AM) *
There are two ways to do this. The first is the 'proper' syntax - the second requires a new class:

<STYLE type="text/css">

input[type=text] {
width: 300px;
background-color: cyan;
}

input.text {
width: 300px;
background-color: yellow;
}

</STYLE>

<FORM>
<input type="text"><br>
<input class="text" type="text"><br>
<input type="text"><br>
<input type="submit">
</FORM>

Excellent info thanks, what about styling the button of the FILE input field??? is there a way to change for example the color and background color of this input field???

Best regards,
Go to the top of the page
 
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Good Text Html Editor(24)
  2. Game Website(4)
  3. Wrap(2)
  4. Html: Alt Text For Objects(8)
  5. Xhtml Is Not Suppose To Be Text/html(8)
  6. Hiding/showing Text On Click(2)
  7. Get Input From Html/txt File?(2)
  8. Animated Favicon With Scrolling Text!(12)
  9. Help With Making A Textbased Game(2)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 09:58 PM