custom_css.md (4414B)
1 # Custom CSS (Advanced) 2 3 CSS (Cascading Style Sheets) is a coding language used alongside HTML, which determines how a web page looks in a web browser: 4 5 > While HTML is used to define the structure and semantics of your content, CSS is used to style it and lay it out. For example, you can use CSS to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. 6 > 7 > -- [Learn CSS (Mozilla)](https://developer.mozilla.org/en-US/docs/Learn/CSS) 8 9 Depending on the settings configured by the admin of your GoToSocial instance, you may be able to upload custom CSS for your account via the User Settings Panel. 10 11 This allows you to customize the appearance of your GoToSocial profile for users visiting it using a web browser. 12 13 ## Example - Changing Background Color 14 15 Here's a standard GoToSocial profile page: 16 17 ![A GoToSocial test profile page. The standard color scheme of grey, blue, and orange.](./../assets/cssstandard.png) 18 19 Let's say we want the background color to be black instead of grey. 20 21 In the User Settings Panel, we enter the following CSS code in the Custom CSS field: 22 23 ```css 24 .page { 25 background: black; 26 } 27 ``` 28 29 We then click on Save Profile Info. 30 31 If we go back to our profile page and refresh the page, it now looks like this: 32 33 ![The same GoToSocial test profile page. The background is now black.](./../assets/cssblack.png) 34 35 If we want to get really fancy, we can add an ombre effect to the background, by using the following CSS code instead: 36 37 ```css 38 .page { 39 background: linear-gradient(crimson, purple); 40 } 41 ``` 42 43 After saving the css and refreshing the profile page, the profile now looks like this: 44 45 ![The same GoToSocial test profile page. The background now starts dark red and fades to purple further down the page.](./../assets/cssgradient.png) 46 47 ## Accessibility 48 49 The importance of accessible HTML and CSS cannot be overstated. From W3: 50 51 > The Web is fundamentally designed to work for all people, whatever their hardware, software, language, location, or ability. When the Web meets this goal, it is accessible to people with a diverse range of hearing, movement, sight, and cognitive ability. 52 > 53 > Thus the impact of disability is radically changed on the Web because the Web removes barriers to communication and interaction that many people face in the physical world. However, when websites, applications, technologies, or tools are badly designed, they can create barriers that exclude people from using the Web. 54 > 55 > Accessibility is essential for developers and organizations that want to create high-quality websites and web tools, and not exclude people from using their products and services. 56 > 57 > -- [Introduction To Web Accessibility](https://www.w3.org/WAI/fundamentals/accessibility-intro/) 58 59 The standard GoToSocial theme is designed with web accessibility in mind, especially when it comes to layout, color contrasts, font sizes, and so on. 60 61 If you write custom CSS for your profile, it is very important that you make sure that it remains legible and that it behaves as expected. Buttons should look like buttons, links should look like links, text should be presented in a readable font, elements should not jump around the page, etc. Web pages can be pretty and exciting without sacrificing readability, or making things overcomplicated. 62 63 If you change your color scheme, it's a good idea to validate the new colors to make sure that they have sufficient contrast to be readable by people with visual impairments like color blindness. Once you've updated your CSS, try entering your profile URL in a contrast checking tool, like the [Color Contrast Accessibility Validator](https://color.a11y.com/Contrast). You can also use the 'Accessibility' tab in the developer tools of your web browser to check for any issues. 64 65 Styling with accessibility in mind makes the web better for everyone! Have a look at the links below for more information. 66 67 ## Useful Links 68 69 - [Learn CSS (Mozilla)](https://developer.mozilla.org/en-US/docs/Learn/CSS) 70 - [CSS Tutorial (W3 Schools)](https://www.w3schools.com/Css/default.asp) 71 - [CSS and JavaScript Accessibility Best Practices (Mozilla)](https://developer.mozilla.org/en-US/docs/Learn/Accessibility/CSS_and_JavaScript#css) 72 - [WAVE Web Accessibility Evaluation Tool](https://wave.webaim.org/) 73 - [Color Contrast Accessibility Validator](https://color.a11y.com/Contrast)