Opera FAQs, Tips, Tricks & Tweaks

Cool tips for Opera browser since 2005

Subscribe to RSS feed

Posts tagged with "CSS"

Find the CSS code to hide anything using Opera Dragonfly

, , , ...

User style sheet can be used to modify the look of a website. Even if you don't know anything about CSS you can find code to hide anything using Opera Dragonfly dragonfly as shown below.

  1. Right click on the item you want to hide and select 'Inspect Element' from the context menu. Opera Dragonfly will open and highlight the element with blue color depending on where you clicked.

    Opera Dragonfly
    Ad is highlighted but the text 'Ad' is not highlighted

  2. Click one by one (in this example li.tas, ol, div#tads.c, ...) from bottom right side until everything you want to hide is highlighted.

    Opera Dragonfly
    Both Ad and text 'Ad' are highlighted

  3. Select and copy code from bottom and add the following at the end.
    {display:none !important;}
    The final code looks like the following.
    div#tads.c {display:none !important;}
  4. Save the CSS code to a file with css extension.
  5. Close Opera Dragonfly.
  6. Right click on the page > Edit Site Preferences... > Display > My style sheet > [Select saved file] > OK
  7. Reload page to apply the style sheet.

Disable auto fit to window of large images in Opera

, , , ...

Opera 11.10 shrinks large images to fit in window and several users don't like this and they want an option to disable it. Auto fit to window of large images can be disable this using any one of the methods below.

Extension
  1. Install Image Autosizer extension.
  2. O Menu > Extensions > Manage Extensions > Gear icon for Image Autosizer > Preferences > Advanced > View modes > When image is larger than window > Enable default & Original

Image Autosizer extension advanced options
Image Autosizer extension advanced options

Style Sheet
  1. Copy C:\Program Files\Opera\styles\image.css in Windows OS or /usr/share/opera/styles/image.css in Linux OS to profile\styles directory. This is to avoid overwriting during update and to make backup easy.
  2. Add the following CSS code to the bottom of copied file and save.
    /* Disable auto resizing of large images code starts here */
    *, *::before, *::after {
        position: static !important;
        height: inherit !important;
        width: inherit !important;
        cursor: default !important;
        padding: 0px !important;
        margin-left:auto;
        margin-right:auto;
    }
    /* Disable auto resizing of large images code ends here */
  3. Choose modified Image Style File and save.
  4. Restart Opera.
This method won't center smaller images.

User JavaScript

Create a NoImgAutoResize.js file with the following code inside userjs directory.

// ==UserScript==
// @description Disables auto resizing of large images
// @author Fartan
// ==/UserScript==

if(document.querySelector("head>link[rel='stylesheet'][href='opera:style/image.css']")) window.donotrun=true;

[Bertalan Dávid & Fartan via forums]

Quickly enable or disable a style using keyboard shortcut/mouse gesture

, , , ...

Author mode and user mode styles can be switched quickly using the default keyboard shortcut, Shift+G but there is no shortcut to enable or disable other styles except View > Style menu.

Any style can be enabled or disabled quickly by using action codes Select user CSS file and Deselect user CSS file respectively. Create a new keyboard shortcut or mouse gesture in Document Window section with the following action code.

Select user CSS file, X | Deselect user CSS file, X

For Windows OS, X = Style sheet number (files sorted in ascending order) - 1. If you don't have any additional CSS style files inside profile\styles\user directory except the default ones, you can use the X value from the following table.

# Style file name Style name X value for Windows OS
1 accessibility.css Accessibility Layout  0 
2 altdebugger.css Alt Debugger 1
3 classid.css Class and Id 2
4 contrastbw.css High Contrast (B/W) 3
5 contrastwb.css High Contrast (W/B) 4
6 disablebreaks.css Disable Breaks 5
7 disablefloats.css Disable Floats 6
8 disableforms.css Disable Forms 7
9 disablepositioning.css Disable Positioning 8
10 disabletables.css Disable Tables 9
11 outline.css Outline 10
12 structureblock.css Block Structure 11
13 structureinline.css Inline Structure 12
14 structuretables.css Table Structure 13
15 tablelayout.css Fixed Table Layout 14
16 toc.css Table of Contents 15

For Linux OS, open terminal and copy & paste the following command to find the X value.

ls ~/.opera/styles/user/ -U | awk '{ print FNR-1 " " $1 }'

Command to find X value in Linux OS
Command to find X value in Linux OS

Example: Action code to enable or disable accessibility layout

For Windows OS,

Select user CSS file, 0 | Deselect user CSS file, 0
For Linux OS,
Select user CSS file, 5 | Deselect user CSS file, 5

If you add additional CSS style files later you may have to change the X value.

Web page looks different in Opera?

, , , ...

If web page looks different from normal then you might have enabled User Mode or style sheet. To bring back normal look disable all except Author Mode in View > Style or O Menu > Page > Style.

Opera Author Mode Style
Normal look (Author mode)

Opera Accessibility Layout Style
Accessibility layout

Opera Block Structure Style
Block structure

Opera Outline Style
Outline

Opera Table of Contents Style
Table of contents

Look with various styles

Style your My Opera news page

, , , ...

Latest news page used to show your blog posts and photos in green color and others in blue color but this was removed in carambola release. Frown

You can bring back colors by using user style sheet. Smile Add the following code to user CSS file and reload news page to apply style sheet.

/* Subscriptions (Latest news) */
.newscontainer h2 { background:#2b7fb6; color:#fff; }
.newsowner h2 { background:#82a70b; }

My Opera news page before
News page before

My Opera news page after
News page after

Quickly check if people are talking to you in Opera IRC

, , , ...

Opera automatically highlights text when other people say your IRC username, to tell you to pay attention. But if you are away for a while you have to scroll up and check. You can use CSS to summarise how many times people have said your name so that you can quickly see if you missed something.

The following will display a counter at the top right corner of the chat window showing how many times people have said your username.

  1. Copy C:\Program Files\Opera\styles\im.css in Windows or /usr/share/opera/styles/im.css in Linux to profile\styles directory. This is to avoid overwriting during update and to make backup easy.
  2. Add the following CSS code to the bottom of copied file and save.
    .highlight {
        counter-increment: personals;
    }
    
    .highlight:after {
        position: fixed;
        top: 0px; right: 0px;
        content: "Your name has been mentioned "counter(personals)" times";
        border: 1px dotted #552;
        padding: 1px;
        background-color: #ffffe1;
        width: 25em;
    }
  3. Specify path to IM Style File and save.
  4. Restart Opera.

Opera Internet Relay Chat
Opera IRC

[Using CSS to disable features of Opera IRC chat]

Use user style sheet to modify the look of a website in Opera

, , , ...

A user style sheet is a text file with CSS declarations. It allows you to have control over the look and feel of website. It can be used to hide annoying things like ads, change fonts and colors, etc.

!important declaration should be added to a rule to take precedence over author style sheet.

User style sheets can be applied to all sites Tools > Preferences... > Advanced > Content > Style Options... > My style sheet (restart required to apply style sheet) or per-site basis Right click on a site > Edit Site Preferences... > Display > My style sheet (reload required to apply style sheet).

Example 1: Hide friend request link in My Opera

My Opera friend request link in top bar
My Opera friend request link in top bar

  1. Create a text file with the following and save preferably inside profile\styles directory with CSS file extension.
    /* Friend request */
    #friendrequest { display: none !important; }

    CSS to hide friend request link and share this button
    CSS to hide friend request link and share this button

  2. Add path to CSS file in site preferences.

    Path to CSS file in site preferences
    Path to CSS file in site preferences

  3. Reload page to apply style sheet.

    My Opera friend request link hidden by CSS
    My Opera friend request link hidden by CSS

Example 2: Hide sponsored links in Google

Google Sponsored Links
Useless Google sponsored links

Google sponsored links can't be blocked by content blocker but it can hidden by following CSS code.

/* Top sponsored links */
#tads { display: none !important; }

/* Side sponsored links */
#mbEnd { display: none !important; }