There are few things I am trying to accomplish here, I want to add a phone number to the “create my account” form of my website, along with that I want to add a style sheet to my html that links to that phone number, (kind of creates a user ID, with phone number), would this be possible?

I am using Magento 2 via AWS lightsail.

Thank you for your help.

  • hey, what do you mean by adding a style sheet to your html, do you want to reference a stylesheet in the head of the document? If so, do you have a theme? – John Feb 13 '18 at 10:58
  • 1
    Hey John, Thank you – rav narayan Feb 14 '18 at 19:48
  • Yes, i do have a theme... but i need to attach it to my html under content-page (magento dashboard). I though if i can upload the files to AWS cloud 9 it should "link" to my html code but it didn't... is there another way around with with/without using cloud 9? maybe through magento dash? – rav narayan Feb 16 '18 at 5:15
  • do you know the URL you are linking to, it's definitely possible if you know the URL you're linking to, Magento actually comes with a feature where you can insert scripts & stylesheets before the head closes in your html – John Feb 16 '18 at 7:42
  • 1
    Hey John, Thank you for getting back to me.. Also thank you for all your help this far. I will follow the instructions that you gave me. Regards, – rav narayan Mar 6 '18 at 6:10

From my conversation in the comments with you You're going to need to go to paste your CSS inside web/css and call it something like, lets say function.css. Save this inside that folder, next go to Vendor/Theme and if there's a Magento_Theme folder there go inside layout and click on default_head_blocks.xml. If not, you will need to create this file structure. (vendor/theme/magento_theme/layout/default_head_blocks.xml). Inside here you're going to want to insert <link rel="stylesheet" type="text/css" href="path/to/file/theme.css"> line just after

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

if you're making this file you then want to write


after it. Save, flush cache and reload the page and the file should be referenced in your head. I hope I've helped

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.