Home>
Currently, I am creating an image posting WEB application like instagram.
The posted images are currently displayed one by one on the top page.
I want to change it so that two images are displayed in order from the top.
Where should I change it? ??
HTML and CSS are quoted from the sample site, and I do not understand the description of the code below.
When you can post two images, arrange the CSS.
Newly posted images are displayed, but Veiw can't implement them as expected.
What I understood, the language for HTML to be displayed on the browser, CSS determines the margins of images and the color of characters.
Corresponding source code
Ruby on rails
app/veiws/layouters/application.html.erb<! DOCTYPE html><html><head><title>NF</title><% = csrf_meta_tags%><% = csp_meta_tag%><link rel = "stylesheet" type = "text/css" href = "http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css"><% = stylesheet_link_tag'application', media:'all','data-turbolinks-track':'reload'%><% = javascript_pack_tag'application','data-turbolinks-track':'reload'%></head><body><header> NF <% if user_signed_in?%> <span><% = current_user.nickname%> <ul> <li> <% = link_to "My Page", "/ users/# {current_user.id}"%> <% = link_to "log out", destroy_user_session_path, method:: delete%> </li> </ul> </span> <% = link_to "post", new_item_path, class: "post"%> <% else%> <% = link_to "login", new_user_session_path, class: "post"%> <% = link_to "new registration", new_user_registration_path, class: "post"%> <% end%> </header><% = yield%><footer> <p> Copyright NF 2020.
</p></footer></body></html>app/veiws/items/index.html.erb<% @ items.each do | item |%><% = render partial: "item", locals: {item: item}%><% end%>app/veiws/items/_item.html.erb
<span><% = image_tag'arrow_top.png'%></span> <ul> <li> <% = link_to'Details', item_path (item.id), method:: get%> </li> <li> <% if user_signed_in?&¤t_user.id == item.user_id%> <% = link_to'edit', edit_item_path (item.id), method:: get%> </li> <li> <% = link_to'Delete', item_path (item.id), method :: delete%> </li> <% end%> </ul> <p><% = item.text%></p> <span> "> <span>Posted by</span><% = item.user.nickname%> </span> app/assets/stylesheets/application.css
/ *
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_ * statement.
* It is generally better to create a new file per style scope.
** = require_tree.
* = require_self
* /
* {
box-sizing: border-box;
}
app/assets/stylesheets/stylesheet.css
@charset "UTF-8";
/*! normalize.css v2.1.3 | MIT License | git.io/normalize * /
/ * ================================================ ==========================
* HTML5 display definitions
* ================================================= ========================= * /
/ *
* Correct `block` display not defined in IE 8/9. * /
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block;
}
/ *
* Correct ʻinline-block` display not defined in IE 8/9. * /
audio,
canvas,
video {
display: inline-block;
}
/ *
* Prevent modern browsers from displaying ʻaudio` without controls.
* Remove excess height in iOS 5 devices. * /
audio: not ([controls]) {
display: none;
height: 0;
}
/ *
* Address `[hidden]` styling not present in IE 8/9.
* Hide the `template` element in IE, Safari, and Firefox<22. * /
[hidden],
template {
display: none;
}
/ * ================================================ ==========================
* Base
* ================================================= ========================= * /
/ *
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom. * /
html {
font-family: sans-serif;
/* 1 * /
-ms-text-size-adjust: 100%;
/* 2 * /
-webkit-text-size-adjust: 100%;
/* 2 * /
}
/ *
* Remove default margin. * /
body {
margin: 0;
}
/ * ================================================ ==========================
* Links
* ================================================= ========================= * /
/ *
* Remove the gray background color from active links in IE 10. * /
a {
background: transparent;
}
/ *
* Address ʻoutline` inconsistency between Chrome and other browsers. * /
a: focus {
outline: thin dotted;
}
/ *
* Improve readability when focused and also mouse hovered in all browsers. * /
a: active,
a: hover {
outline: 0;
}
/ * ================================================ ==========================
* Typography
* ================================================= ========================= * /
/ *
* Address variable `h1` font-size and margin within` section` and ʻarticle`
* contexts in Firefox 4+, Safari 5, and Chrome. * /
h1 {
font-size: 2em;
margin: 0.67em 0;
}/ *
* Address styling not present in IE 8/9, Safari 5, and Chrome. * /
abbr [title] {
border-bottom: 1px dotted;
}
/ *
* Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome. * /
b,
strong {
font-weight: bold;
}
/ *
* Address styling not present in Safari 5 and Chrome. * /
dfn {
font-style: italic;
}
/ *
* Address differences between Firefox and other browsers. * /
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/ *
* Address styling not present in IE 8/9. * /
mark {
background: yellow;
color: black;
}
/ *
* Correct font family set oddly in Safari 5 and Chrome. * /
code,
kbd,
pre,
samp {
font-family: monospace, serif;
font-size: 1em;
}
/ *
* Improve readability of pre-formatted text in all browsers. * /
pre {
white-space: pre-wrap;
}
/ *
* Set consistent quote types. * /
q {
quotes: "" "" "" "" "" ";
}
/ *
* Address inconsistent and variable font size in all browsers. * /
small {
font-size: 80%;
}
/ *
* Prevent `sub` and` sup` affecting `line-height` in all browsers. * /
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/ * ================================================ ==========================
* Embedded content
* ================================================= ========================= * /
/ *
* Remove border when inside ʻa` element in IE 8/9. * /
img {
border: 0;
}
/ *
* Correct overflow displayed oddly in IE 9. * /
svg: not (: root) {
overflow: hidden;
}
/ * ================================================ ==========================
* Figures
* ================================================= ========================= * /
/ *
* Address margin not present in IE 8/9 and Safari 5. * /
figure {
margin: 0;
}
/ * ================================================ ==========================
* Forms
* ================================================= ========================= * /
/ *
application.css is like this.
What I tried
Understand the structure of HTML and CSS
Supplementary information (FW/tool version, etc.)Please provide more detailed information here.
-
Answer # 1
Related articles
- ruby on rails - i want to change only a part of the partial template
- ruby on rails - when i changed the data type, i got an sql error i don't know where the cause is
- ruby on rails - i don't know where to check the method
- ruby on rails 6 - i want to change the display of the product detail page according to the user's conditions
- ruby - [rails] i want to change the argument of link_to using conditional branching
- ruby - i want to know where to install rails gem and how to manage it
- ruby on rails 5 - error about rails where method
- ruby on rails - you cannot change the keychain after downloading the pem file when creating an ec2 instance the matter that come
- ruby - i want to set the search condition of rails where to the date of created_at (time is not included)
- ruby on rails - i want to sort the search results
- ruby on rails - i want to solve the problem that scss is not applied after modifying the scss file with rails
- ruby - ssl_connect returned = 1 errno = 0 state = error: wrong version number
- ruby on rails - phenomenon that the test that should be an "rspec" error passes
- ruby on rails - i get an error in a program that changes over time
- about validation of ruby on rails
- ruby on rails 5 - transaction exception handling doesn't work
- ruby - [rails 5] i want to send an email to a specific user using action mailer
- ruby on rails - i want to launch rails with a new file
- ruby on rails - about the legitimacy of db design
Trends
- python - you may need to restart the kernel to use updated packages error
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to check the type of a shell script variable
- i want to call a child component method from a parent in vuejs
If so, rather than asking what you want to do functionally
You should be asked the meaning of the code in the part you don't understand.
The answer to this question is as follows.
And
It seems that it can be realized like this.