内容页ContentPlaceHolder里使用CSS

我想在内容页里放个文本框和按钮,然后让他们并排,我加了CSS不行,网上查了说内容页不能使用CSS好像,那应该怎么做才能让他们并排呢?

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
 <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  <div style="float:left; ">
  <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  </div>
  <div style="float:left; ">
  <asp:Button ID="Button1" runat="server" Text="Button" />
  </div>

米脂
浏览 701回答 2
2回答

郎朗坤

内容页可以使用CSS文件;前提是你在模板页head标签间挖个坑,然后这个坑专门用来写样式和脚本。你那个漂浮只是在div所在的这个坑漂浮,能不能实现并排还得看你在模板页面怎么挖的坑

撒科打诨

site.master关键部分<head> &nbsp; &nbsp;<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> &nbsp; &nbsp;<link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> &nbsp; &nbsp;<asp:ContentPlaceHolder ID="IncludeContent" runat="server" /></head><body>...在内容页<asp:Content ID="Content3" ContentPlaceHolderID="IncludeContent" runat="server"> &nbsp;<script type="text/javascript" src="../../Scripts/MicrosoftAjax.js"></script> &nbsp;<script type="text/javascript" src="../../Scripts/MicrosoftMvcValidation.js"></script></asp:Content>
打开App,查看更多内容
随时随地看视频慕课网APP