Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHenrik Christensen
Python Web Development Techdegree Student 38,322 Pointsasp.net bootstrap footer
Hi,
I'm trying to make a website using ASP.NET and bootstrap, but I'm having an issue with the footer in 1 of my pages, and I can't really figure what the problem might be.
My footer works perfect on all the pages but in my portfolio.cshtml it's only 75% of the width in landscape mode on mobile devices (i.e. iPhone 5) and it's driving me crazy :-/
Any1 who know how to fix this? :-)
_Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Henrik Abel Christensen || HenrikAC Portfolio</title>
<link href="~/Content/slate.min.css" rel="stylesheet" type="text/css">
<link href="~/Content/style.css" rel="stylesheet" type="text/css">
<link href="~/Content/responsive.css" rel="stylesheet" type="text/css">
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
</head>
<body>
<div class="wrapper">
<header>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("HenrikAC", "index", "home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>@Html.ActionLink("Home", "index", "home")</li>
<li>@Html.ActionLink("Portfolio", "portfolio", "home")</li>
<li>@Html.ActionLink("About me", "about", "home")</li>
<li>@Html.ActionLink("Contact", "contact", "home")</li>
</ul>
</div>
</div>
</div>
</header>
<main>
<div class="container body-content">
@RenderBody()
</div>
</main>
</div>
<footer>
<div class="navbar navbar-default">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-push-8">
<ul class="nav navbar-nav sc-center">
<li><a href="http://www.codepen.com/regnis" target="_blank">CodePen</a></li>
<li><a href="http://www.github.com/henrikac" target="_blank">GitHub</a></li>
</ul>
</div>
<div class="col-md-8 col-md-pull-4">
<p class="navbar-text sc-center">
© @DateTime.Now.Year - Henrik Abel Christensen
</p>
</div>
</div>
</div>
</div>
</footer>
<script src="~/Scripts/bootstrap.min.js"></script>
@if (IsSectionDefined("AddScript"))
{
@RenderSection("AddScript", required: false)
}
</body>
</html>
Portfolio.cshtml
@model Portfolio.Models.Projects[]
@{
ViewBag.Title = "My Portfolio";
}
<h2 class="text-center">Portfolio</h2>
<div class="row equal">
@foreach (var project in Model)
{
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title text-center">@project.Title</h4>
</div>
<div class="panel-body">
<a href="@Url.Action(project.Title.ToLower(), "portfolio", new { id = project.Id })">
<img src="~/Images/@project.ImageFileName" alt="@project.Title" class="img-responsive" />
</a>
<p>@project.Description</p>
</div>
</div>
</div>
}
</div>
style.css
body {
padding-top: 70px;
}
.wrapper {
min-height: calc(100vh - 82px);
}
h2 {
padding-bottom: 15px;
}
.panel-body p {
padding-top: 5px;
}
.sc-center {
text-align: center;
}
.sc-center li {
display: inline-block;
}
footer .navbar {
margin-bottom: 0px;
}
#changeUnits,
#quote-me,
#tweet,
#searching,
#randomArticle,
#start {
border-radius: 3px;
outline: 0;
}
/*******************
WEATHER APP
********************/
#icon img {
height: 75px;
width: 75px;
}
#changeUnits {
margin-top: 10px;
padding: 10px;
}
/*******************
QUOTE APP
********************/
.quotes {
margin-top: 15px;
}
/*******************
Wikipedia App
********************/
.input-sm{
border: 1px solid #000;
border-radius: 4px;
padding: 17px 12px;
font-size: 14px;
}
#randomArticle {
margin-top: 15px;
margin-bottom: 15px;
}
#searchList {
list-style: none;
}
/*******************
Rock, Paper, Scissors
********************/
.rps,
#start {
margin-top: 15px;
}
responsive.css
@media screen and (min-width: 568px) {
.equal, .equal > div[class*='col-'] {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
flex:1 1 auto;
}
.wrapper {
min-height: calc(100vh - 51px);
}
footer .nav {
float: right;
}
footer p {
float: left;
}
}
@media screen and (min-width: 768px) {
.wrapper {
min-height: calc(100vh - 40px);
}
.navbar-default .navbar-nav li a {
border-left: none;
border-right: none;
}
.navbar {
border-radius: 0;
}
h2 {
padding-bottom: 45px;
}
}
1 Answer
Edward Ries
7,388 PointsI don't know the answer right off but I highly suspect the following css class is causing the issue.
@media screen and (min-width: 568px) {
.equal, .equal > div[class*='col-'] {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
flex:1 1 auto;
}
Try adding/removing each attribute to see the effect that is being applied.
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsHenrik Christensen
Python Web Development Techdegree Student 38,322 PointsYeah that was my thought too and been trying for almost two days to fix it - I did a read-up on flexbox and tried this instead which seems to fix the problem :-)
Thank you very much for helping :-)