.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
The sample you link to has both an input control and a label element. The markup you have shown only has an input. Where is your label? You are not going to get the desired label formatting if you do not have a label!
You are not following the example HTML design. The "row" class defines a row block and that's why a div used. A div is a block element and can contain other HTML elements. You are applying the class to a label. A label renders as a span which is an inline
element. An inline element is used to bold a section of text. An inline element does not contain other elements.
You need to learn HTML and CSS in order to understand how to design the HTML. Your CSs is looking for a "span" within a "row" class. Your HTML design does not have a span within a row. Since labels render as a span the markup should like this the following.
Like the previous suggestions, I also recommendations learning how to use the browser's dev tools. Dev tools shows the CSS applied to each element which is very powerful. But you need to have a solid understanding of HTML and CSS.
Lastly, you might consider moving to MVC. MVC is a lot easier to work with when it comes to CSS. Web Forms is tricky because you have less control over the HTML rendering.
Member
10 Points
16 Posts
How to add multiple css to textbox
Dec 01, 2020 11:14 PM|Uruse1980|LINK
Hi!
I have this css code (generated thanks to https://www.html-code-generator.com):
if i create a button like this, all works ok:
In my aspx page i have this textbox:
How to add the previous css to my textbox? I tried with these solutions:
CssClass="row"
CssClass="textbox "
CssClass="textboxe"
BUT dont work!
Thanks at all
Contributor
3730 Points
1420 Posts
Re: How to add multiple css to textbox
Dec 02, 2020 02:06 AM|yij sun|LINK
Hi Uruse1980,
Accroding to you description,as far as I think,you could do like this:
<asp:TextBox ID="txtemail" runat="server" Height="30px" Width="250px" CssClass="row textbox textboxe"></asp:TextBox>
Result:
Best regards,
Yijing Sun
Member
70 Points
79 Posts
Re: How to add multiple css to textbox
Dec 02, 2020 03:46 AM|ifour.parth@gmail.com|LINK
You can also add jquery and their css
http://www.ifourtechnolab.com/blockchain-technology
Member
10 Points
16 Posts
Re: How to add multiple css to textbox
Dec 04, 2020 08:48 PM|Uruse1980|LINK
Hi! Thanks for your help!
Unfortunately the effect that you have posted it is not the correct effect. The correct textbox can be found here:
https://www.html-code-generator.com/css/textbox-style
is the number 78 on page 4
Thanks!
Participant
1620 Points
927 Posts
Re: How to add multiple css to textbox
Dec 05, 2020 05:09 AM|PaulTheSmith|LINK
The sample you link to has both an input control and a label element. The markup you have shown only has an input. Where is your label? You are not going to get the desired label formatting if you do not have a label!
Member
10 Points
16 Posts
Re: How to add multiple css to textbox
Dec 05, 2020 04:03 PM|Uruse1980|LINK
Thanks Paul, you are right. Despite this I cannot reproduce it in .aspx page. Can you help me? Thanks.
Participant
1620 Points
927 Posts
Re: How to add multiple css to textbox
Dec 06, 2020 05:16 AM|PaulTheSmith|LINK
If you don't have a label then you will not have a formatted label.
If you want a formatted label you need to add a label first.
Add your label so that the resulting page has the same html structure as the example you are trying to reproduce.
Member
10 Points
16 Posts
Re: How to add multiple css to textbox
Dec 06, 2020 12:33 PM|Uruse1980|LINK
Why don't work?
All-Star
53041 Points
23613 Posts
Re: How to add multiple css to textbox
Dec 06, 2020 01:44 PM|mgebhard|LINK
You are not following the example HTML design. The "row" class defines a row block and that's why a div used. A div is a block element and can contain other HTML elements. You are applying the class to a label. A label renders as a span which is an inline element. An inline element is used to bold a section of text. An inline element does not contain other elements.
You need to learn HTML and CSS in order to understand how to design the HTML. Your CSs is looking for a "span" within a "row" class. Your HTML design does not have a span within a row. Since labels render as a span the markup should like this the following.
Like the previous suggestions, I also recommendations learning how to use the browser's dev tools. Dev tools shows the CSS applied to each element which is very powerful. But you need to have a solid understanding of HTML and CSS.
Lastly, you might consider moving to MVC. MVC is a lot easier to work with when it comes to CSS. Web Forms is tricky because you have less control over the HTML rendering.