简体   繁体   中英

how do you set css to add an asp img?

how do you set css to add an asp img?

I need to control the size of the image within the div aswell and its alignment? Preferably to the right and make it 15% of the size inside the div?

Any of this possible?

div#test {
width:90%; 
z-index:1; 
padding:27.5px; 
border-top: thin solid #736F6E;
border-bottom: thin solid #736F6E;
color:#ffffff;
margin:0 auto;
white-space: pre;
white-space: pre-wrap;
white-space: pre-line;
word-wrap: break-word;
}

Chances are no.

If you mean an image server control (either <asp:Image> or `) CSS is a client-side technology while any Asp.NET server controls are server-side. (keyword: in server controls is server ;) )

If you mean an HTML image ( <img> with no runat="server" ) then no again. You'd use JavaScript to do this: CSS cannot add elements (things with tags like <img> ) to the document. It can add text context using the content property but not elements like <img> .

Lastly, if you mean give "the div" a background image, yes, CSS can do this, using the background-image property... but I don't think you can resize background images. Maybe with CSS3... I'm not sure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM