Navigating the world of CSS with Razor

Utilizing Razor for the creation of a dynamic website, I have set up my _siteLayout.cshtml file where I defined the header, footer, and the body section to be replaced by @RenderBody()

<header>
</header>

<section id="content" class=" clearfix">
@RenderBody()
</section>

<footer>     
</footer>

Next, I created a page with various sections that I want to separate into left and right parts. Here is the HTML code for this page:

<div id="trans" class="wrapper"> 
<h1>&nbsp Ricensioni</h1>


<div class="review_wrapper">

            <div class="left_section">
@foreach(var row in data)
{
    <div class="left_review"> 
        <span class="user">@row.Name<span>:</span></span>
        <br> @row.Data
    </div>
    <div class="right_review"> 
        <div class="innerBubble">
            <p> @row.Reff </p>
        </div>
        </div>

}
</div>

<div class="right_section">
    <h3>Aggiungi la tua recensione</h3>
    <form action="" method="post">
        <p>Nome:<input type="text" name="formName" id="formName" class="text" maxlength="120"></p>
        <p>Testo:</p>
        <textarea name="formText" id="formText" class="text  defaultText"> </textarea>
        <p><input type="submit" value="Invia" /></p>
    </form>
</div>

    </div>
   </div>

When attempting to adjust the CSS properties for the sections by using float:

#left_section{width: 474px;float: left;}

#right_section{width: 474px; float: right;}

Razor fails to recognize these sections and shifts them downwards, causing overlap with the footer.

You can view the image here.

This issue is critical for me as I am working with a database and the page will continue to expand vertically.

CSS code:

/* CSS Code */
html,body { margin: 0; padding: 0; border: 0; background-color: #f5f5f5; }
html { font-size: 62.5%; -webkit-touch-callout:none; -webkit-text-size-adjust:none; -ms-text-size-adjust:100%; }
body { line-height: 22px; font-size: 16px; color: #897c74; font-family: Georgia, Utopia, 'Times New Roman', Times, serif; } 

footer, header{ display:block; }
section{display: block;}

header {
    font-weight:400; color:#727074; 
    margin: 0 0 0px 0;
    padding: 0px;
    border-bottom: 80px solid #e5e5e5;
}

...

input.text {
    margin-right: 2px;
    padding: 2px;
    border: 1px solid #c8c8c8;
    background-color: #fff;
}

I would greatly appreciate any guidance on resolving this issue. As a newcomer here, I apologize if this question seems trivial.

Answer №1

The issue at hand has nothing to do with Razor. It appears that the problem arises from using a sticky footer. I recommend utilizing Bootstrap to avoid encountering similar issues with floating divs and sticky footers.

You can refer to this example - http://getbootstrap.com/examples/sticky-footer-navbar/ - for creating a sticky footer.

Furthermore, you can use this example - http://getbootstrap.com/examples/grid/ - to divide your webpage into left and right sections using a two-column layout.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best location to integrate jQuery UI Bootstrap in a Rails project

In order to use Bootstrap and jQuery UI together in my application, I decided to integrate jQuery UI Bootstrap. Unfortunately, many of the gems that handle asset pipeline integration seem outdated, so I opted to manually download the CSS files and insert t ...

Return to the previous URL after executing window.open in the callback

I need help redirecting the callback URL back to the parent window that initially called window.open. Right now, the callback URL opens inside the child window created by the parent. Here's the scenario: The Parent Window opens a child window for aut ...

Ways to adjust the border color when error helper text is displayed on a TextField

I am currently working with React Material UI's TextField element. What I aim to achieve is when the submit button is pressed, the helpertext displayed should be "Please enter the password." It should look like this: https://i.sstatic.net/Nu0ua.png ...

Creating an arrow dialog box in Material UI: A step-by-step guide

I have successfully created an arrow box (div) using custom CSS and HTML. However, I am facing difficulty in implementing the same design in Material UI with React JS. The code below demonstrates how to achieve this using custom CSS. My question is: How ...

Show/Hide sections of content that transition and rearrange the layout of the page

I have a layout with 9 squares on a page. When clicking on a square, I want a full-width div to appear underneath it, pushing the other squares down. I've tried following a tutorial to understand the JavaScript behind this functionality, but I'm ...

Place a div on top of a table

I am facing a challenge with table rows and divs. The height of the table row is set to 100px, while divs can be up to 200px. I want the div to overlay the table and cover the bottom row if it exceeds the row's height. Currently, I have achieved this ...

I require assistance in eliminating the border around the search bar

When I have a search bar and don't click on it, it looks like the image belowhttps://i.sstatic.net/SbDbf.png But as soon as I type something, a blue border appears that I don't want. I'm not sure how to remove ithttps://i.sstatic.net/bOsjO. ...

Uploading files with Angular and NodeJS

I am attempting to achieve the following: When a client submits a form, they include their CV AngularJS sends all the form data (including CV) to the Node server Node then saves the CV on the server However, I am encountering difficulties with this proc ...

Updating data in a SQL database using PHP when a button is clicked

This Question was created to address a previous issue where I had multiple questions instead of focusing on one specific question Objective When the user selects three variables to access data, they should be able to click a button to modify one aspect o ...

Prevent Android WebView from attempting to fetch or capture resources such as CSS when using loadData() method

Context To many, this situation might appear to be repetitive. However, I assure you that it is not. My objective is to import html data into a WebView, while being able to intercept user hyperlink requests. During this process, I came across this helpfu ...

The color of hyperlinks in firefox varies based on the specific URL being visited

I am a beginner in the world of html and css. I have two links placed consecutively. In my css file, I have defined classes for a:link and a:hover. However, I noticed that the second link is displaying a purple color instead of silver. Both links correctly ...

How can you set the dimensions of rows and columns in an HTML table?

I am currently working on setting specific sizes for each data cell in a table. While most cells are supposed to be the same size, I am encountering an issue where cells marked as d, h, l, and p are smaller than the rest even though I have specified their ...

Overriding a CSS property with !important proves ineffective

I need to make adjustments to an old internal page that currently has the following CSS styling: table { font-family: "Arial"; font-size: 13px; text-align: left; border-collapse: collapse; border: 1px solid black; vertical-align: m ...

To activate two separate click events, one for an absolute element and another for the element positioned behind it, simply click on the desired absolute element to trigger both actions

Is it possible to trigger click events for both of these elements? position: relative container ELEMENT 1: standard div ELEMENT 2: position: absolute div In real life, element 2 is a transparent backdrop designed to capture clicks on top of the header ...

Problem with alternating row colors in my table

Trying to add some style to my table on the webpage by alternating row colors, but I'm running into some issues. I've followed tutorials and tried using different CSS selectors like nth-of-type(even), nth-of-type(2n+0), and nth-of-type(odd). Howe ...

Prevent the modification of a session

My dilemma involves a piece of code that produces a random number ranging from 1 to 1000. This number is then saved as a session and sent to you via email where it needs to be entered into a form before submission. However, the issue arises when submitting ...

Resizing Images with Bootstrap

While working with twitter bootstrap 2.2.2, I have noticed that the image in the "hero" div resizes correctly when the page loads initially. However, it then unexpectedly expands beyond the div boundaries and gets cut off. You can view the page here: It ...

What is the most effective method for implementing a background repeated image in Foundation 4 framework?

Currently, I am utilizing the foundation4 framework for my website. In order to achieve a repeating tiled background, I have crafted a custom CSS file and included the following code snippet: body { background: url(img/floorboardsbg.jpg) repeat; } Whi ...

Using a variable with the :contains selector

function checkAndUpdateStatus(newName) { $('#myTable').children('tr').remove(":contains('" + newName + "')"); }; The function above is attempting to remove table rows in 'myTable' containing a string matching the ...

"Encountering issues while upgrading Polymer project version from 0.5 to 1.0

I am in the process of upgrading my project from polymer .5 to polymer 1.0. After installing the new version of the polymer library, iron element, and paper element, I encountered the following error: polymer-micro.html:63 Uncaught TypeError: prototype ...