SASS styling for a blog website - optimizing button placement in Ruby on Rails

I am facing an issue where the "New post" and "Log out" buttons on my blog website are displaying on the left side of the header under "All posts" instead of the right side. You can see a screenshot of my project here.

Here is the snippet from my "application.html.erb" file:

 <!DOCTYPE html>
 <html>
 <head>
<title>Blog</title>
 <%= csrf_meta_tags %>

 <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
 <%= stylesheet_link_tag 'application' , 'http://fonts.googleapis.com/css?family=Raleway:400,700' %>

<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>

<body>
<div id="sidebar">
    <div id="logo">
        <%= link_to root_path do%> 
            <%= image_tag "logo.svg" %> 
        <% end %> 
    </div>

    <ul> 
        <li class="category">Website</li>
        <li><%= link_to "Blog", root_path %></li>
        <li>About</li>
    </ul>

    <ul>
        <li class="category">Social</li>
        <li><a href="">Facebook</a></li>
        <li><a href="">GitHub</a></li>
        <li><a href="">Gmail</a></li>
    </ul>

    <p class="sign_in">Admin Login</p>
</div>
</div>

<div id="main_content"> 
  <div id="header">
        <p>All posts</p>

        <div class="bottons">
            <button class="button"><%= link_to "New Post", new_post_path %>
    </button>
            <button class="button">Log Out</button>
        </div>
    </div>

    <% flash.each do |name, msg| %> 
        <%= content_tag(:div, msg, class: "alert") %>
    <% end %>

    <%= yield %>
</div>
</body>
</html>

And here is the content from my "application.css.scss" file:

@import 'normalize';

html, body {
font-family: 'Raleway', sans-serif;

<!-- More CSS code follows -->

I kindly request assistance in moving these buttons to the right side of the header. Thank you!

Answer №1

Your class name is misspelled in the application.html.erb file for the buttons div. Please update it from:

<div class="bottons"> ...

to

<div class="buttons"> ...

Check out this functional example on fiddle.

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

Utilizing a Downloaded Font in CSS: A Step-by-Step

Just starting out here. I have a font file in .ttf format that I want to use on my blog, but I need help with obtaining its code. Am I on the right track? * { font-family: 'providence-bold'; src: url('/font/providence-bold.regular.tt ...

Methods for concealing the "image not found" icon in Internet Explorer and Chrome through CSS

I have images displayed on a webpage. Currently, when an image is not available, both Chrome and IE display a broken image indicator. I want to hide this indicator and only show the alternative text. Is there a CSS solution to achieve this? ...

Ways to quickly change a class when clicking (without waiting for mouse button release)

Is there a way to instantly change the color of my span element when it's clicked by the user, rather than waiting for the mouse button to be released? This is the CSS code I'm using for the class: span.active{ color:#bdbcae; } I've tri ...

Problem with fetching Grails

I have a table nested within an anchor tag. The table is centered on the page, with each row containing an image. When the page loads, I noticed the following: a) The table initially appears at the top-left corner of the screen. b) As there are multiple v ...

How can I escape the bracket in the name tag using AngularJs?

Creating a Rails Project involves setting up a user login form using devise, but encountering issues with ng-show implementation. <%= f.email_field :email,class: "form-control", autofocus: true, placeholder: "input your email",required: true,"ng-mode ...

Want to learn how to center a webpage only for a specific device width? For example, have your mobile device display the content in the center, while

Hello! I'm new to the world of @media queries and am currently trying to make my webpage responsive by centering it on smaller devices while keeping the display normal on larger screens. My website, mastercontrolunit.com, looks great in deskto ...

Issue with displaying Django-filer in the admin area

After completing the setup steps outlined in the django-filer documentation, I launched the development server on my local machine to check if everything was functioning correctly. However, upon accessing the django admin site and navigating to the filer f ...

Position the div at the bottom of the page

I managed to successfully position the div at the bottom using this code snippet: #div { position: absolute; width: 100%; height: 58px; margin: 0 auto; bottom: 0; left: 0; overflow: hidden; } Lately, I decided to add a sidebar ...

Stylesheets are being requested over the network, however, they are not being applied to the HTML

https://i.sstatic.net/GGYxm.png The screenshot above shows the initial setup in Firefox's developer tools. There is a <link rel="stylesheet"> in the header, but no styles are applied to the <body> element in the lower viewport. The second ...

Tips for customizing bootstrap cards to display on a single row with four columns

I've been working on my Angular application and I'm using a Bootstrap card to display some information. Unfortunately, I can't seem to get the design to look how I want it to, even after trying multiple approaches. The component.html code ...

What is the reason behind an inline element being able to have an explicit width when floating?

When trying to set the width for an inline element <span> within a table-row containing multiple span elements, I encountered difficulty. However, after adding float: left, I was finally able to adjust the width. What is the reason behind the initia ...

Is it possible to create a grid by arranging each statement with a specific format?

After fetching and parsing some data, I have utilized the 'each' function to display it: $.ajax({ url : 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent('htt ...

Unable to interact with menu in Internet Explorer

I am facing an issue with my code that should create a dropdown menu when hovered on, but it is not working properly in Internet Explorer. Instead of dropping down the menu, IE pushes it to the right, making it impossible to interact with. Surprisingly, th ...

React Redux encountered an issue with the absence of the 'Access-Control-Allow-Origin' header on the requested resource, causing the origin 'null' to be denied access

I am currently using React, Redux, and RoR in my app. I need to implement social login. On the client side, I am utilizing davezuko/react-redux-starter-kit, which is hosted on localhost:3000. My server is running on localhost:5000. All requests from the cl ...

How can the hover effect be disabled when the pseudo-element is being hovered over?

I need the hover effect (the background of the pseudo-element changing to green) to only show up when the button is being hovered over. Right now, it also triggers when hovering over the pseudo-element itself (green box). button { box-sizing: border ...

Odd spacing at the bottom of the page

I'm experiencing an issue with the footer on my homepage - it has a strange margin around it that I can't seem to get rid of. What I really want is a simple footer with 100% width, similar to the one on this page. However, as you can see in the i ...

Styling PHP Input Buttons with CSS

I'm facing an issue with styling the button on a working form. Even though I added CSS and declared the button class, it's not applying the styles. The CSS is defined at the top of the HTML file, and the PHP code is embedded within. Both classes ...

Slider initialization will commence once the slides have been successfully appended

I've been struggling with a jQuery slider that should load after a series of animations finish. Even though I'm appending slides to the slider and trying to initialize it, the slides end up stacking vertically instead of sliding horizontally. My ...

Uploading images with AJAX using Rails, Backbone, and Remotipart

For some time, I've had success using Remotipart to upload images via AJAX. However, we have made the decision to switch to Backbone recently. Now that my forms are generated through JS templates, I am unable to utilize the :remote => true syntax t ...

assigning a CSS class to an input element based on a certain condition

My dilemma involves an input field for which I need to conditionally apply a CSS class. For instance, if firstName == undefined, I want to apply the CSS class ng-dirty. To achieve this, I attempted: <input required [(ngModel)]="customer.firstName" nam ...