To specify an element with only certain attributes set, use this:
exampletag[exampleattrib="examplevalue"]
For example, a paragraph with the height set to 300 will have a red background:
p[height="300"] { background: #ff0000; }
<p height="300">This should have a red background.</p>
Hope I helped :)... read more.
Well, I always try to avoid as much class and id as I can since along the way when we writing code, once in a while I will forget to put these attribute in. Even though I will eventually figure out where in my code I missed, it's still better to have a "global" setting which will makes sure consistency for me.
You can match <input> elements that have the type=text property in CSS2 by using the rule "input[type=text] { }". However, I highly doubt that this is fully supported by many browsers, and so your best choice would probably be to nest the input inside a span like viz said.
Notice from vizskywalker:
Edited on user's Request, next time, report the post instead of making another one though
You can match <input> elements that have the type=text property in CSS2 by using the rule "input[type=text] { }". However, I highly doubt that this is fully supported by many browsers, and so your best choice would probably be to nest the input inside a span like viz said.
This is the way to do it. It is good coding style to define the type attribute for all form fields, although "text" is assumed the default.
This is in fact supported in many browsers, but not in Internet Explorer (surprise, surprise ) Usually this isn't a problem as CSS is most of the time used to change the form field colours, backgrounds, borders; stuff that IE users can do without. But width is something you gotta get right on every browser.
If you really need the option and can't come up with other solution, you might wish to try Dean Edwards IE7: http://dean.edwards.name/IE7/ It fixes most if IE CSS issues, with no need for users to install anything.
Change: "It is good coding style to define the type attribute for all form fields" to "It is good coding style to define the type attribute for all form fields anyways"
You absolutely need to define the attribute in order the CSS2 attrribute matching to work.
There is one possible solution, although 1) i have never tested it, and 2) I don't know if it is valid CSS.
Try this:
CODE
input:text { width: 400px; }
The alternative is to simply pecify width in the html tag without using css, or nest the input in a <style> tag.
~Viz
Try this
CODE
<input type="text" style="width:400px" />
you can use a sty;e with most HTML elements such as the input, the above code will make a test box that is 400px wide and yes it is valid so embed the style into the tag you are concerned with when you told it input (width:400px then all input types took on that attribute, just use it in those input fields by whatever type you want to effect because you have text inputs, submit inputs, password input, checkbox inputs radio button inputs and so on, so you need to just put the style in those you want to make bigger.
you can use a sty;e with most HTML elements such as the input, the above code will make a test box that is 400px wide and yes it is valid so embed the style into the tag you are concerned with when you told it input (width:400px then all input types took on that attribute, just use it in those input fields by whatever type you want to effect because you have text inputs, submit inputs, password input, checkbox inputs radio button inputs and so on, so you need to just put the style in those you want to make bigger.
You didn't read my orginal post. I said that there must be no additional attribute put in HTML code. `style` here is an attribute, and yes, I can't use it. 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).
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???
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?
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.
Anybody needs Animated FavIcon with your site address scrolling on that along with your logo?
Check this site! Thats the site without any customization Options! But if you need to customize
the Animated Icon, please reply here (In the sense, Fonts & Color Customization) Im doing it
for Free! Example is here: checkOut the fav icon for: www.niranvv.com and
www.fun.niranvv.com You can see one Icon along with one Scrooling Text: NiranVv.Com in the
icon! So, if you need that one, ask here! I'll give you the animated favIcon(Gif Format) ....
I was just wondering if it's possible to retrieve text (and maybe images) from a .html or .txt
file. So for example you get the header and footer from an external file. Is it possible with just
html/css and maybe a little javascript or does it require server side scripting like php???
-=jeroen=-....
Ok, I got an question: I want to make a site with a news box or something similar. It's gonna be
a table with a small piece of text and an "read more" button. Now I want to make it so that if
people click on the "read more" there will appear an other piece of text underneath it. How do I do
this? thanks in advance, -=jeroen=-....
I am quite disappointed in IE's development as with keeping up but still if they feel they need
to fully work on current things that they have already attempted to resolve and perfect then that is
a good thing, but development should have never got so messy and only the developer would know that
it's his fault and not MS's. This isn't to bad mouth IE, but it's so sad to know
that even after 5 years or more of IE6, IE7 has no intention of supporting XHTML and I don't
think I can wait for IE8 if development takes such a long time. They should also....
My site is going to use a lot of Flash files pluged into the page. I embed it into the page like
this: CODE What I want to know is: Is it possible to give the object an alt text?
Something like the alt="The Flash File" that is used in IMG tags is what I want. I've tried
putting it inside the object tag, param tag and embed tag. That didn't work.....
I am trying to wrap text after a textbox. It is working fine on IE. but it doesn't work on
Netscape 7.0 and Firefox 1.0.1 /huh.gif" style="vertical-align:middle" emoid=":huh:" border="0"
alt="huh.gif" /> Following is the code: CODE Airport/city
name or 3 letter code. The "Airport/city name or 3 letter code. " text waps
around in IE by not in NN or firefox. Do somebody tell me how to do it?
Notice
from m^e:
Please put your code between CODE tags from next time onwards. That ....
I want to make a online game website, can I do with astohost? I been trying to get a free website
but it's seems to harder then I thought, I hope this one work, everytime I apply they never send
a confirmation email. Will the site I get from astohost be able to do what I want, a text base game
with some animation, like flash, I need help so if anyone can help let me know.....
Does someone know good text HTML editor for web page creation?(sure, I mean text editor, not
WYSWYG). There is no reason to stick with Notepad when there is a set of the various special html
editors much more convenient than ms Notepad. No any of microsoft products does not not suit for
html editing, and Frontpage is absolute rotten.....
1st Page 2000 1st Page 2000 is the tool that lets you create powerful, great looking websites
fast, easier and on-time. AceExpert In addition to being an excellent HTML editor, AceExpert
also greatly assists you with predefined Java applets and JavaScripts. AceExpert is the solution for
developers who want to integrate the latest technologies into their Web pages. Simple and easy to
use, AceExpert gives you the full power of a complete HTML Editor. Arachnophilia Arachnophilia
lets you use two methods to create Web pages: The 'old-fashioned way' with th....