By default, the JavaScript Calendar component fills the available width. This behavior corresponds to display:block
style.
You can set a custom width using the width property. It accepts a string in CSS format.
See also responsive column width.
JavaScript Example
<div id="calendar"></div>
<script>
const calendar = new DayPilot.Calendar("calendar", {
width: "80%";
});
calendar.init();
</script>
ASP.NET WebForms
<DayPilot:DayPilotCalendar
runat="server"
id="DayPilotCalendar1"
Width="100%"
...
/>
ASP.NET MVC
@Html.DayPilotCalendar("dpc", new DayPilotCalendarConfig {
BackendUrl = ResolveUrl("~/Calendar/Backend"),
Width = "100%",
...
})
Java
<div id="dpc"></div>
<script type="text/javascript">
var dpc = new DayPilot.Calendar("dpc");
dpc.backendUrl = "${pageContext.request.contextPath}/dpc";
dpc.width = "100%";
// ...
dpc.init();
</script>