読みづらい所あるかと思いますがご容赦ください。私はプログラミング初学者で、現在学習課題である、
Railsでフリマサイトアプリの作成中です。新規会員ページフロントマークアップのみのビューを確認したところ。CSSが効いていない箇所があるのですが原因が自分の力では見つけられず、質問いたしました。
●やりたいこと
写真hamlのfooter_centerクラス内の子要素であるgrayクラス、incクラスをfooterの中央に配置されるようcssを効かせたいです。(fmarketという灰色のロゴ、Mercari.incという文字をfooterの中央に配置)
●調べてみた事、仮説
display: inline-block;を親要素であるfooter_centerに当てれば配置されると思っていたのですが、css自体が当たってないのは親子関係が不適切なのではと思い検証ツールを用いてみたのですがうまくいきませんでした。
index.html.haml
1.contena 2 .user_new_header 3 .logo 4 =link_to root_path do 5 = image_tag "fmarket_logo_red.svg", size: "185x49", alt: "フリマのアイコン" 6 .user_new_main 7 .contents 8 .registration 9 .new_member 10 .new_member_name 新規会員登録 11 .mail_sns 12 .box 13 %i.far.fa-envelope.mail_address メールアドレスで登録する 14 %i.fab.fa-facebook-square.blue_sns Facebookで登録する 15 %i.fab.fa-google.white_sns Google+で登録する 16 .user_new_footer 17 .head 18 .info_box 19 .privacy ●プライバシーポリシー 20 .terns ●利用規約 21 .specific ●特定商取引に関する表記 22 .footer_logo_box 23 .footer_center 24 .gray 25 =link_to root_path do 26 = image_tag "logo_gray.svg", size: "80x65", alt: "フリマのアイコン" 27 .inc © Mercar![イメージ説明](b9682ab25e71894e68d5862657fe9e6a.png). 28
signup/index.scss .contena { .user_new_header { height: 128px; color: #ffffff; .logo { text-align: center; line-height: 90px; padding-top: 40px; } .img { } } .user_new_main { height: 344px; .contents { // height: calc(100vh - 128px); width:700px; margin: 0 auto; background-color: #ffffff; .registration { height: 344px; text-align: center; box-sizing: border-box; .new_member { padding: 32px; border-bottom: 1px solid #f5f5f5; } .new_member_name { font-size: 22px; font-weight: bold; } .mail_sns { height: 247px; padding: 24px 16px 40px; // text-align: center; box-sizing: border-box; } .box { margin: 0 auto; display: inline-block; .mail_address { background-color: #ff0000; color: white; height: 50px; width: 343px; border-radius: 4px; font-size:14px; text-decoration: none; line-height: 50px; } .blue_sns { background-color: #4169e1; color: white; height: 50px; width: 343px; border-radius: 4px; font-size:14px; text-decoration: none; line-height: 50px; margin: 16px 0 0; } .white_sns { background-color: #d3d3d3; height: 50px; width: 343px; border-radius: 4px; font-size:14px; text-decoration: none; line-height: 50px; margin: 16px 0 0; } } } } }} .user_new_footer { height: calc(100vh - 128px -344px); margin: 0 auto; // box-sizing: border-box; .head { } .info_box { text-align: center; height: 12px; padding: 40px 0; .privacy { display: inline-block; font-size: 12px; color: #808080; } .terns { font-size: 12px; display: inline-block; color: #808080; } .specific { font-size: 12px; display: inline-block; color: #808080; } .footer_logo_box { width: 1012px; height: 220px; .footer_center { height: 220px; width: 456px; text-align: center; display: inline-block; margin:0 auto; .gray { margin:0 auto; } .inc { font-size: 13px; } }}}}
回答1件
あなたの回答
tips
プレビュー